Fred1990

Member
Hi guys, is there a tutorial for add custom ingots and ores?

My custom material is Silver.

>>>I'm filled out this line too to the resourcesinfo.cs,

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

********************



>>>This on ingots.cs
public override int LabelNumber
{
get
{
if ( m_Resource >= CraftResource.DullCopper && m_Resource <= CraftResource.Silver )
return 1042684 + (int)(m_Resource - CraftResource.DullCopper);
return 1042692;
}
}
}

*********************

>>>This on the ore.cs
public override int LabelNumber
{
get
{
if ( m_Resource >= CraftResource.DullCopper && m_Resource <= CraftResource.Silver )
return 1042845 + (int)(m_Resource - CraftResource.DullCopper);
return 1042853; // iron ore;
}
}



*****************************

>> and filled out the lines copying the code of an existing material, on ores.cs - ingot.cs - armorenums.cs - basearmor - resourcesinfo -defblacksmith.cs - baseweapon.cs - craftitem.cs .
The sequence is correct the silver material is after valorite material .

Do you have any idea?



errors:
+ Engines / Craft / DefBlacksmithy.cs:
CS0246: Line 663: The type or name of the 'SilverIngot' namespace was not found. Probably missing a using directive or an assembly reference
+ Engines / Harvest / Mining.cs:
CS0246: Line 96: The type or name of the 'SilverOre' namespace was not found. Probably missing a using directive or an assembly reference
CS0246: Line 96: The type or name of the 'SilverGranite' namespace was not found. Probably missing a using directive or an assembly reference
+ Items / Resources / Blacksmithing / Ore.cs:
CS0246: Line 647: The type or name of the 'SilverIngot' namespace can not be found. Probably missing a using directive or an assembly reference
+ Misc / ResourceInfo.cs:
CS0161: Line 656: 'Server.Items.CraftResources.GetFromOreInfo (Server.Items.OreInfo)': Not all code paths return a value.
CS0246: Line 468: The type or name of the 'SilverIngot' namespace can not be found. Probably missing a using directive or an assembly reference
CS0246: Line 468: The type or name of the 'SilverOre' namespace was not found. Probably missing a using directive or an assembly reference
CS0246: Line 468: The type or name of the 'SilverGranite' namespace was not found. Probably missing a using directive or an assembly reference
 
You need to add it to ResourceInfo.cs and to the various items listed above, if i remember right, Ingot.cs should have all the classes for the ingots from iron to valorite, you should add your SilverIngot to it, etc.

Search for every instances of DullCopper, and search from there.
As for how the item displays in the craft menu, perhaps you would need to add your own method to get the display name (instead of using clilocs).
 
You need to add it to ResourceInfo.cs and to the various items listed above, if i remember right, Ingot.cs should have all the classes for the ingots from iron to valorite, you should add your SilverIngot to it, etc.

Search for every instances of DullCopper, and search from there.
As for how the item displays in the craft menu, perhaps you would need to add your own method to get the display name (instead of using clilocs).





Hi
I have this methods on


>>> Ingots.cs


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.Silver; break;
default: info = null; break;



[FlipableAttribute(0x1BF2, 0x1BEF)]
public class SilverIngot : BaseIngot
{
[Constructable]
public SilverIngot() : this( 1 )
{
}
[Constructable]
public SilverIngot( int amount ) : base( CraftResource.Silver, amount )
{
}
public SilverIngot( 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();
}


>>>On Ingots.cs

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.Silver; break;
default: info = null; break;
}

[FlipableAttribute(0x1BF2, 0x1BEF)]
public class SilverIngot : BaseIngot
{
[Constructable]
public SilverIngot() : this( 1 )
{
}
[Constructable]
public SilverIngot( int amount ) : base( CraftResource.Silver, amount )
{
}
public SilverIngot( 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();
}


>>> On resoucesinfo.cs ( i copied only the interested part)

public enum CraftResource
{
None = 0,
Iron = 1,
DullCopper,
ShadowIron,
Copper,
Bronze,
Gold,
Agapite,
Verite,
Valorite,
Silver, <<<

public static readonly CraftAttributeInfo Blank;
public static readonly CraftAttributeInfo DullCopper, ShadowIron, Copper, Bronze, Golden, Agapite, Verite, Valorite, Silver; <<<
public static readonly CraftAttributeInfo Spined, Horned, Barbed;

CraftAttributeInfo silver = Silver = new CraftAttributeInfo();
silver.ArmorPhysicalResist = 4;
silver.ArmorColdResist = 3;
silver.ArmorPoisonResist = 3;
silver.ArmorEnergyResist = 3;
silver.ArmorDurability = 50;
silver.WeaponFireDamage = 10;
silver.WeaponColdDamage = 20;
silver.WeaponPoisonDamage = 10;
silver.WeaponEnergyDamage = 20;
silver.RunicMinAttributes = 5;
silver.RunicMaxAttributes = 5;
if (Core.ML)
{
silver.RunicMinIntensity = 85;
silver.RunicMaxIntensity = 100;
}
else
{
silver.RunicMinIntensity = 50;
silver.RunicMaxIntensity = 100;
}



public class CraftResources
{
private static CraftResourceInfo[] m_MetalInfo = new CraftResourceInfo[]
{


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( 0xA08, 1061354, "Silver", CraftAttributeInfo.Silver, CraftResource.Silver, typeof( SilverIngot ), typeof( SilverOre ), typeof( SilverGranite ) ),
};



public static CraftResource GetFromOreInfo( OreInfo info )
{
return CraftResource.Valorite;
else if (info.Level == 9)
return CraftResource.Silver;
else if (info.Level == 10)
}


public class OreInfo
{
public static readonly OreInfo Valorite = new OreInfo( 8, 0x8AB, "Valorite" );
public static readonly OreInfo Silver = new OreInfo( 9, 0xA08, "Silver");

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

In these files is all correct I think
I use runuo 2.3
[doublepost=1550050728][/doublepost]ON ARMORENUMS

public enum ArmorMaterialType
{
Cloth,
Leather,
Studded,
Bone,
Spined,
Horned,
Barbed,
Ringmail,
Chainmail,
Plate,
Dragon, // On OSI, Dragon is seen and considered its own type.
Silver <<<

ON BASEARMOR

switch ( m_Resource )
{

case CraftResource.Verite: ar += 14; break;
case CraftResource.Valorite: ar += 16; break;
case CraftResource.Silver: ar += 10; break; <<<

}


switch ( reader.ReadInt() )
{
default:
case 8: info = OreInfo.Valorite; break;
case 9: info = OreInfo.Silver; break; <<<
}


witch ( m_Resource )
{
case CraftResource.DullCopper: oreType = 1053108; break; // dull copper
case CraftResource.ShadowIron: oreType = 1053107; break; // shadow iron
case CraftResource.Copper: oreType = 1053106; break; // copper
case CraftResource.Bronze: oreType = 1053105; break; // bronze
case CraftResource.Gold: oreType = 1053104; break; // golden
case CraftResource.Agapite: oreType = 1053103; break; // agapite
case CraftResource.Verite: oreType = 1053102; break; // verite
case CraftResource.Valorite: oreType = 1053101; break; // valorite
case CraftResource.Silver: oreType = 1061354; break; // silver <<<<<<<<<<<<
case CraftResource.SpinedLeather: oreType = 1061118; break; // spined
case CraftResource.HornedLeather: oreType = 1061117; break; // horned
case CraftResource.BarbedLeather: oreType = 1061116; break; // barbed
case CraftResource.RedScales: oreType = 1060814; break; // red
case CraftResource.YellowScales: oreType = 1060818; break; // yellow
case CraftResource.BlackScales: oreType = 1060820; break; // black
case CraftResource.GreenScales: oreType = 1060819; break; // green
case CraftResource.WhiteScales: oreType = 1060821; break; // white
case CraftResource.BlueScales: oreType = 1060815; break; // blue
default: oreType = 0; break;
}


ON BASEWEAPON


switch ( m_Resource )
{

case CraftResource.Valorite: oreType = 1053101; break; // valorite
case CraftResource.Silver: oreType = 1061354; break; // silver

default: oreType = 0; break;
}



CraftResource thisResource = CraftResources.GetFromType( resourceType );
if ( thisResource == ((BaseRunicTool)tool).Resource )
{
Resource = thisResource;
CraftContext context = craftSystem.GetContext( from );
if ( context != null && context.DoNotColor )
Hue = 0;
switch ( thisResource )
{

case CraftResource.Silver:
{
Identified = true;
DurabilityLevel = WeaponDurabilityLevel.Indestructible;
DamageLevel = WeaponDamageLevel.Vanq;
AccuracyLevel = WeaponAccuracyLevel.Supremely;
break;
[doublepost=1550051019][/doublepost]On Defblacksmithy

// Set the overridable material
SetSubRes( typeof( IronIngot ), 1044022 );
// Add every material you want the player to be able to choose from
// This will override the overridable material
AddSubRes( typeof( ValoriteIngot ), 1044030, 95.0, 1044036, 1044268 );
AddSubRes( typeof( SilverIngot ), 1061722, 70.0, 1044036, 1044268 );

On Repair.cs

switch ( resource )
{

case CraftResource.Valorite: difficulty = 95.0; break;
case CraftResource.Silver: difficulty = 80.0; break;
 
Please, drag and drop Ingot.cs and ResourceInfo.cs in your reply.
I suspect you have a wrongly placed bracket.

Are you using an IDE like Visual Studio?
 
hi Pooka yes i'm using visual studio , I have attached the files too.

here the

ingots.cs

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(); }
}
public override double DefaultWeight
{
get { return 0.1; }
}

int ICommodity.DescriptionNumber { get { return LabelNumber; } }
bool ICommodity.IsDeedable { get { return true; } }
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.Silver; 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;
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.Silver )
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();
}

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

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

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

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

}

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

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

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

}
[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();
}
[FlipableAttribute(0x1BF2, 0x1BEF)]
public class SilverIngot : BaseIngot
{
[Constructable]
public SilverIngot() : this( 1 )
{
}
[Constructable]
public SilverIngot( int amount ) : base( CraftResource.Silver, amount )
{
}
public SilverIngot( 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();
}



}
}
}



Resourcesinfo.cs


using System;
using System.Collections;
namespace Server.Items
{
public enum CraftResource
{
None = 0,
Iron = 1,
DullCopper,
ShadowIron,
Copper,
Bronze,
Gold,
Agapite,
Verite,
Valorite,
Silver,
RegularLeather = 101,
SpinedLeather,
HornedLeather,
BarbedLeather,
RedScales = 201,
YellowScales,
BlackScales,
GreenScales,
WhiteScales,
BlueScales,
RegularWood = 301,
OakWood,
AshWood,
YewWood,
Heartwood,
Bloodwood,
Frostwood
}
public enum CraftResourceType
{
None,
Metal,
Leather,
Scales,
Wood
}
public class CraftAttributeInfo
{
private int m_WeaponFireDamage;
private int m_WeaponColdDamage;
private int m_WeaponPoisonDamage;
private int m_WeaponEnergyDamage;
private int m_WeaponChaosDamage;
private int m_WeaponDirectDamage;
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 WeaponChaosDamage{ get{ return m_WeaponChaosDamage; } set{ m_WeaponChaosDamage = value; } }
public int WeaponDirectDamage{ get{ return m_WeaponDirectDamage; } set{ m_WeaponDirectDamage = 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, Silver;
public static readonly CraftAttributeInfo Spined, Horned, Barbed;
public static readonly CraftAttributeInfo RedScales, YellowScales, BlackScales, GreenScales, WhiteScales, BlueScales;
public static readonly CraftAttributeInfo OakWood, AshWood, YewWood, Heartwood, Bloodwood, Frostwood;
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;
if ( Core.ML )
{
dullCopper.RunicMinIntensity = 40;
dullCopper.RunicMaxIntensity = 100;
}
else
{
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;
if ( Core.ML )
{
shadowIron.RunicMinIntensity = 45;
shadowIron.RunicMaxIntensity = 100;
}
else
{
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;
if ( Core.ML )
{
copper.RunicMinIntensity = 50;
copper.RunicMaxIntensity = 100;
}
else
{
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;
if ( Core.ML )
{
bronze.RunicMinIntensity = 55;
bronze.RunicMaxIntensity = 100;
}
else
{
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;
if ( Core.ML )
{
golden.RunicMinIntensity = 60;
golden.RunicMaxIntensity = 100;
}
else
{
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;
if ( Core.ML )
{
agapite.RunicMinIntensity = 65;
agapite.RunicMaxIntensity = 100;
}
else
{
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;
if ( Core.ML )
{
verite.RunicMinIntensity = 70;
verite.RunicMaxIntensity = 100;
}
else
{
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;
if ( Core.ML )
{
valorite.RunicMinIntensity = 85;
valorite.RunicMaxIntensity = 100;
}
else
{
valorite.RunicMinIntensity = 50;
valorite.RunicMaxIntensity = 100;
}
CraftAttributeInfo silver = Silver = new CraftAttributeInfo();
silver.ArmorPhysicalResist = 4;
silver.ArmorColdResist = 3;
silver.ArmorPoisonResist = 3;
silver.ArmorEnergyResist = 3;
silver.ArmorDurability = 50;
silver.WeaponFireDamage = 10;
silver.WeaponColdDamage = 20;
silver.WeaponPoisonDamage = 10;
silver.WeaponEnergyDamage = 20;
silver.RunicMinAttributes = 5;
silver.RunicMaxAttributes = 5;
if (Core.ML)
{
silver.RunicMinIntensity = 85;
silver.RunicMaxIntensity = 100;
}
else
{
silver.RunicMinIntensity = 50;
silver.RunicMaxIntensity = 100;
}


CraftAttributeInfo spined = Spined = new CraftAttributeInfo();
spined.ArmorPhysicalResist = 5;
spined.ArmorLuck = 40;
spined.RunicMinAttributes = 1;
spined.RunicMaxAttributes = 3;
if ( Core.ML )
{
spined.RunicMinIntensity = 40;
spined.RunicMaxIntensity = 100;
}
else
{
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;
if ( Core.ML )
{
horned.RunicMinIntensity = 45;
horned.RunicMaxIntensity = 100;
}
else
{
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;
if ( Core.ML )
{
barbed.RunicMinIntensity = 50;
barbed.RunicMaxIntensity = 100;
}
else
{
barbed.RunicMinIntensity = 40;
barbed.RunicMaxIntensity = 100;
}
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 static readonly CraftAttributeInfo OakWood, AshWood, YewWood, Heartwood, Bloodwood, Frostwood;
CraftAttributeInfo oak = OakWood = new CraftAttributeInfo();
CraftAttributeInfo ash = AshWood = new CraftAttributeInfo();
CraftAttributeInfo yew = YewWood = new CraftAttributeInfo();
CraftAttributeInfo heart = Heartwood = new CraftAttributeInfo();
CraftAttributeInfo blood = Bloodwood = new CraftAttributeInfo();
CraftAttributeInfo frost = Frostwood = new CraftAttributeInfo();
}
}
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, 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, "Golden", 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( 0xA08, 1061354, "Silver", CraftAttributeInfo.Silver, CraftResource.Silver, typeof( SilverIngot ), typeof( SilverOre ), typeof( SilverGranite ) ),
};


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 ) ),
};
private static CraftResourceInfo[] m_WoodInfo = new CraftResourceInfo[]
{
new CraftResourceInfo( 0x000, 1011542, "Normal", CraftAttributeInfo.Blank, CraftResource.RegularWood, typeof( Log ), typeof( Board ) ),
new CraftResourceInfo( 0x7DA, 1072533, "Oak", CraftAttributeInfo_OakWood, CraftResource.OakWood, typeof( OakLog ), typeof( OakBoard ) ),
new CraftResourceInfo( 0x4A7, 1072534, "Ash", CraftAttributeInfo.AshWood, CraftResource.AshWood, typeof( AshLog ), typeof( AshBoard ) ),
new CraftResourceInfo( 0x4A8, 1072535, "Yew", CraftAttributeInfo.YewWood, CraftResource.YewWood, typeof( YewLog ), typeof( YewBoard ) ),
new CraftResourceInfo( 0x4A9, 1072536, "Heartwood", CraftAttributeInfo.Heartwood, CraftResource.Heartwood, typeof( HeartwoodLog ), typeof( HeartwoodBoard ) ),
new CraftResourceInfo( 0x4AA, 1072538, "Bloodwood", CraftAttributeInfo.Bloodwood, CraftResource.Bloodwood, typeof( BloodwoodLog ), typeof( BloodwoodBoard ) ),
new CraftResourceInfo( 0x47F, 1072539, "Frostwood", CraftAttributeInfo.Frostwood, CraftResource.Frostwood, typeof( FrostwoodLog ), typeof( FrostwoodBoard ) )
};
/// <summary>
/// Returns true if '<paramref name="resource"/>' is None, Iron, RegularLeather or RegularWood. False if otherwise.
/// </summary>
public static bool IsStandard( CraftResource resource )
{
return ( resource == CraftResource.None || resource == CraftResource.Iron || resource == CraftResource.RegularLeather || resource == CraftResource.RegularWood );
}
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.Scales: list = m_ScaleInfo; break;
case CraftResourceType.Wood: list = m_WoodInfo; 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.Silver )
return CraftResourceType.Metal;
if ( resource >= CraftResource.RegularLeather && resource <= CraftResource.BarbedLeather )
return CraftResourceType.Leather;
if ( resource >= CraftResource.RedScales && resource <= CraftResource.BlueScales )
return CraftResourceType.Scales;
if ( resource >= CraftResource.RegularWood && resource <= CraftResource.Frostwood )
return CraftResourceType.Wood;
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.Scales: return CraftResource.RedScales;
case CraftResourceType.Wood: return CraftResource.RegularWood;
}
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.Silver;
else if (info.Level == 10)
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 Silver = new OreInfo( 9, 0xA08, "Silver");
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;
}
}
}
}
 

Attachments

  • ResourceInfo.cs
    27.5 KB · Views: 4
  • Ingots.cs
    9.2 KB · Views: 8
Please, do not paste the content of the files in your thread, they take space, aren't formatted and are hard to read.
I will take a look at those files.
[doublepost=1550366516][/doublepost]That shoud suffice.
Be careful what you paste in your code and where you paste it; a computer will do litterally what you ask it to do in a format it expects, forgetting even the smallest semi-column somewhere in c# can prevent it from compiling as it can't be processed correctly.

classdefinition.png commas.png
See attachments.
If you have further questions resulting of this, do not hesitate.
 
Last edited:
Hi Pooka thanks for your reply and tips, so even if silver is the last methos I need to put only 2 braces? because visual studio says error .
I will try soon and see if runuo works:) .
[doublepost=1550403626][/doublepost]I tried how you say leaving only 2 braces at the end but I got this;

+ Items / Resources / Blacksmithing / Ingots.cs:
CS1513: Line 460: The sign is expected}
CS1513: Line 460: The sign is expected}
 
You did not fix the main issue, SilverIngot is still inside ValoriteIngot.
Check where the brackets start and end, they must always be in pair somewhere.
 
I cancelled the my last reply sorry,


I added some materials, is correct the 4 brackets at the
line 548 > Resourceinfo.cs and

and 5 brackets at the
line 99 > mining.cs ?

I got error maybe if for the wrong brackets?

+ Engines / Harvest / Mining.cs:
CS1502: Line 98: The best match of overloaded method for 'Server.Engines.Harvest.HarvestResource.HarvestResource (double, double, double, object, params System.Type [])' has some invalid arguments
CS1503: Line 99: Argument '6': Unable to convert from 'Server.Engines.Harvest.HarvestResource' to 'System.Type'.
CS1502: Line 97: The best match of overloaded method for 'Server.Engines.Harvest.HarvestResource.HarvestResource (double, double, double, object, params System.Type [])' has some invalid arguments
CS1503: Line 98: Argument '6': Unable to convert from 'Server.Engines.Harvest.HarvestResource' to 'System.Type'.
CS1502: Line 91: The best match of overloaded method for 'Server.Engines.Harvest.HarvestResource.HarvestResource (double, double, double, object, params System.Type [])' has some invalid arguments
CS1503: Line 92: Argument '6': Unable to convert from 'Server.Engines.Harvest.HarvestResource' to 'System.Type'.
CS1503: Line 93: Argument '7': Unable to convert from 'Server.Engines.Harvest.HarvestResource' to 'System.Type'.
CS1503: Line 94: Argument '8': Unable to convert from 'Server.Engines.Harvest.HarvestResource' to 'System.Type'.
CS1503: Line 95: Argument '9': Unable to convert from 'Server.Engines.Harvest.HarvestResource' to 'System.Type'.
CS1503: Line 96: Argument '10': Unable to convert from 'Server.Engines.Harvest.HarvestResource' to 'System.Type'.
CS1503: Line 97: Argument '11': Unable to convert from 'Server.Engines.Harvest.HarvestResource' to 'System.Type'.
+ Misc / ResourceInfo.cs:
CS0103: Line 298: The name 'Silver' does not exist in the current context.
CS0117: Line 540: 'Server.Items.CraftAttributeInfo' does not contain a definition for 'Silver'.
CS1502: Line 547: The best match of overloaded method for 'Server.Items.CraftResourceInfo.CraftResourceInfo (int, int, string, Server.Items.CraftAttributeInfo, Server.Items.CraftResource, Params System.Type [])' presents some invalid arguments
CS1503: Line 548: Argument '8': Unable to convert from 'Server.Items.CraftResourceInfo' to 'System.Type'.
CS1502: Line 546: The best match of overloaded method for 'Server.Items.CraftResourceInfo.CraftResourceInfo (int, int, string, Server.Items.CraftAttributeInfo, Server.Items.CraftResource, Params System.Type [])' presents some invalid arguments
CS1503: Line 547: Argument '8': Unable to convert from 'Server.Items.CraftResourceInfo' to 'System.Type'.
[doublepost=1550584306][/doublepost]here the correct mining sorry..
[doublepost=1550588128][/doublepost]np I'm trying to put I try to insert them one by one :)
 

Attachments

  • ResourceInfo.cs
    26.1 KB · Views: 2
  • Mining.cs
    15.6 KB · Views: 3
Last edited:
In the mining.cs file, check the brackets, see where they need to start and end.
They aren't placed correctly.
 
I know I'm missing something simple but I can't seem to see it, adding the 5 new ores. Could someone take a look and tell me what I screwed up please?

Errors:
+ Misc/ResourceInfo.cs:
CS0117: Line 769: 'CraftAttributeInfo' does not contain a definition for 'Blaze'
CS0117: Line 770: 'CraftAttributeInfo' does not contain a definition for 'Ice'
CS0117: Line 771: 'CraftAttributeInfo' does not contain a definition for 'Toxic'
CS0117: Line 772: 'CraftAttributeInfo' does not contain a definition for 'Electrum'
CS0117: Line 773: 'CraftAttributeInfo' does not contain a definition for 'Platinum'
CS0103: Line 361: The name 'Blaze' does not exist in the current context
CS0103: Line 378: The name 'Ice' does not exist in the current context
CS0103: Line 395: The name 'Toxic' does not exist in the current context
CS0103: Line 412: The name 'Electrum' does not exist in the current context
CS0103: Line 429: The name 'Platinum' does not exist in the current context
+ Items/Resource/Ore.cs:
CS0117: Line 90: 'OreInfo' does not contain a definition for 'Blaze'
CS0117: Line 93: 'OreInfo' does not contain a definition for 'Ice'
CS0117: Line 96: 'OreInfo' does not contain a definition for 'Toxic'
CS0117: Line 99: 'OreInfo' does not contain a definition for 'Electrum'
CS0117: Line 102: 'OreInfo' does not contain a definition for 'Platinum'
+ Items/Resource/Ingots.cs:
CS0117: Line 134: 'OreInfo' does not contain a definition for 'Blaze'
CS0117: Line 137: 'OreInfo' does not contain a definition for 'Ice'
CS0117: Line 140: 'OreInfo' does not contain a definition for 'Toxic'
CS0117: Line 143: 'OreInfo' does not contain a definition for 'Electrum'
CS0117: Line 146: 'OreInfo' does not contain a definition for 'Platinum'
Scripts: One or more scripts failed to compile or no script files were found.
 

Attachments

  • Mining.cs
    19.3 KB · Views: 0
  • Ingots.cs
    17.1 KB · Views: 0
  • Ore.cs
    28.3 KB · Views: 1
  • ResourceInfo.cs
    43.8 KB · Views: 1
In your resourceinfo.cs you have...

C#:
    public class CraftResources
    {
        private static readonly 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( 1161,    0,      "Blaze",        CraftAttributeInfo.Blaze,       CraftResource.Blaze,        typeof( BlazeIngot ),       typeof( BlazeOre )),
            new CraftResourceInfo( 1152,    0,      "Ice",          CraftAttributeInfo.Ice,         CraftResource.Ice,          typeof( IceIngot ),         typeof( IceOre )),
            new CraftResourceInfo( 1272,    0,      "Toxic",        CraftAttributeInfo.Toxic,       CraftResource.Toxic,        typeof( ToxicIngot ),       typeof( ToxicOre )),
            new CraftResourceInfo( 1278,    0,      "Electrum",     CraftAttributeInfo.Electrum,    CraftResource.Electrum,     typeof( ElectrumIngot ),    typeof( ElectrumOre )),
            new CraftResourceInfo( 1153,    0,      "Platinum",     CraftAttributeInfo.Platinum,    CraftResource.Platinum,     typeof( PlatinumIngot ),    typeof( PlatinumOre ))
        };

But... if you back track in the same file to around line 172, you'll see you haven't defined them here...

C#:
public CraftAttributeInfo()
{
}

public static readonly CraftAttributeInfo Blank;
public static readonly CraftAttributeInfo DullCopper, ShadowIron, Copper, Bronze, Golden, Agapite, Verite, Valorite;
public static readonly CraftAttributeInfo Spined, Horned, Barbed;
public static readonly CraftAttributeInfo RedScales, YellowScales, BlackScales, GreenScales, WhiteScales, BlueScales;
public static readonly CraftAttributeInfo OakWood, AshWood, YewWood, Heartwood, Bloodwood, Frostwood;

static CraftAttributeInfo()
{

Slow down and read the error's a couple of times if you need to (i do some days), it will point you in the right direction 99.9 % of the time.

Have fun ;)
 
Omg, I had that edited the first time and I when I rolled everything back, for other errors and started over, I guess I forgot that area. Thanks, I'll try when I get home
 
In your resourceinfo.cs you have...

C#:
    public class CraftResources
    {
        private static readonly 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( 1161,    0,      "Blaze",        CraftAttributeInfo.Blaze,       CraftResource.Blaze,        typeof( BlazeIngot ),       typeof( BlazeOre )),
            new CraftResourceInfo( 1152,    0,      "Ice",          CraftAttributeInfo.Ice,         CraftResource.Ice,          typeof( IceIngot ),         typeof( IceOre )),
            new CraftResourceInfo( 1272,    0,      "Toxic",        CraftAttributeInfo.Toxic,       CraftResource.Toxic,        typeof( ToxicIngot ),       typeof( ToxicOre )),
            new CraftResourceInfo( 1278,    0,      "Electrum",     CraftAttributeInfo.Electrum,    CraftResource.Electrum,     typeof( ElectrumIngot ),    typeof( ElectrumOre )),
            new CraftResourceInfo( 1153,    0,      "Platinum",     CraftAttributeInfo.Platinum,    CraftResource.Platinum,     typeof( PlatinumIngot ),    typeof( PlatinumOre ))
        };

But... if you back track in the same file to around line 172, you'll see you haven't defined them here...

C#:
public CraftAttributeInfo()
{
}

public static readonly CraftAttributeInfo Blank;
public static readonly CraftAttributeInfo DullCopper, ShadowIron, Copper, Bronze, Golden, Agapite, Verite, Valorite;
public static readonly CraftAttributeInfo Spined, Horned, Barbed;
public static readonly CraftAttributeInfo RedScales, YellowScales, BlackScales, GreenScales, WhiteScales, BlueScales;
public static readonly CraftAttributeInfo OakWood, AshWood, YewWood, Heartwood, Bloodwood, Frostwood;

static CraftAttributeInfo()
{

Slow down and read the error's a couple of times if you need to (i do some days), it will point you in the right direction 99.9 % of the time.

Have fun ;)
Well, the fix worked for the Resourceinfo file but the ingot and ore file still threw the same errors. Going thru them again to see where I missed it but I'm still not seeing it. 1 down, 2 to go lol

I found a missing line in the Ore one, line 798 wasn't replicated below that for the new types so I added it in and corrected but it didn't change any errors, still got all 5 from ingot and ore just like the first time

Edit - Found the errors in the Resource info. There was like 3 other sections I missed where I needed more data put in. It's compiled now so off to test. Thank you again for pointing me in the right direction
 
Last edited:
Hey there @FingersMcSteal any chance you wanna see what I'm overlooking again? I figured, well since I was shown where to look to get thru the ore, and I figured out by following the trail and where else to look, and I got all of them working with your help, I thought I'd work on the wood next (the 5 after frostwood) How hard could it be? I was overconfident apparently. Sigh.......the 2 resource files I believe have the offending info in them that's causing the other 5 files to error out. Might just the the resourceinfo that has the error but I'm not sure. I looked for the word Frost and everywhere that was, I added the next set of wood data or in some instances, replaced frostwood with petrified but it's the same errors as the ore one so I know it's in there, I just can't see it. Sorry to be a pita

all of the wood types are giving the same error in all 7 files
CS0246: Line 134: The type or namespace name 'EbonyBoard' could not be found (are you missing a using directive or an assembly reference?)
 

Attachments

  • Resource Helper.cs
    20.9 KB · Views: 2
  • ResourceInfo.cs
    48.8 KB · Views: 2
Last edited:
CS0246: Line 134: The type or namespace name 'EbonyBoard' could not be found (are you missing a using directive or an assembly reference?)

Have you defined them yet ? The same way you made your new ingot types.

C#:
public class ValoriteOre : BaseOre
{
    protected override CraftResource DefaultResource { get { return CraftResource.Valorite; } }

    [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 BaseIngot GetIngot()
    {
        return new ValoriteIngot();
    }
}
public class BlazeOre : BaseOre
{
    [Constructable]
    public BlazeOre()
        : this(1)
    {
    }

    [Constructable]
    public BlazeOre(int amount)
        : base(CraftResource.Blaze, amount)
    {
        Name = "Blaze Ore"; //daat99 OWLTR - custom resource name
    }

    public BlazeOre(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 BaseIngot GetIngot()
    {
        return new BlazeIngot();
    }
}

Remember you made your new ingots like this, you need to do the same for your logs & boards.
 
I can't find anywhere for any of the woods that have this code tho. Woods.cs doesn't, resourceinfo doesn't, resources doesn't so I'm not sure where it's at
 
After much turmoil, it all seems to work now but I had to remove the achievement system that was on Minax because as soon as I swung the axe at a tree, the server rebooted. I could spawn the resources fine, craft with em, add em to the keys, all that but the second I tried to actually chop a tree, reboot. I pulled the achievement folder from the directory and commented out 2 lines from the player mobile that referenced it and all works fine. Not sure what in that system is wigging out from the harvest attempt
 
This is the whole system as far as i know.

Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Server.Achievements.HarvestAchievement.<>c__DisplayClass14_0.<CheckAchievementMatch>b__2(HarvestResource hr)
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
at Server.Achievements.AchievementSystem.CheckAchievement(Mobile m, AchievementType type, Object check)
at Server.Achievements.AchievementSystem.ResourceHarvestSuccess(ResourceHarvestSuccessEventArgs e)
at Server.EventSink.InvokeResourceHarvestSuccess(ResourceHarvestSuccessEventArgs e)
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)

and then these 2 lines commented out from playermobile

//list.Add(new Server.Achievements.AchivementGumpEntry(this));

//list.Add(new Server.Achievements.AchivementGumpEntry((PlayerMobile)from, this));

Once the achievement folder is removed and those lines are out, new ore and wood work perfect
 

Attachments

  • AchievementSystem.zip
    30.4 KB · Views: 4
Take a look in... Lumberjacking.cs file...

around lines 83, 94, 144, 223

Try adding your new woods in that file and see if it works when you hit the trees ?

I'm not 100 % sure since i don't run the latest versions but the whole resource system looks like it runs through this Achievements system.
 
Lumberjacking was already modded. Don't recall the line #s but they were added in there. If there was a lije that listed the woods, I added the new ones after. If there was a lone that listed the last(hardest) to gather, frostwood maybe? Then i changed it to petrified.
 
Last edited:
Oh well, worth a try ;)
I'll double check around those lines tonight, just to be sure I didn't miss anything tho
@FingersMcSteal Checked my lumberjacking and i had 3 of those 4 spots so not sure if i'm missing what you have around 144 or not. I have included mine so you could see it.
 

Attachments

  • Lumberjacking.cs
    16.2 KB · Views: 0
Last edited:

Active Shards

Donations

Total amount
$0.00
Goal
$500.00
Back