BritainKnights/Scripts/Items/Treasure/Loot.cs

630 lines
No EOL
23 KiB
C#

using System;
using System.IO;
using System.Reflection;
using Server;
using Server.Items;
namespace Server
{
public class Loot
{
#region List definitions
private static Type[] m_WeaponTypes = new Type[]
{
typeof( Axe ), typeof( BattleAxe ), typeof( DoubleAxe ),
typeof( GreatAxe ), typeof( Hatchet ), typeof( LargeBattleAxe ),
typeof( TwoHandedAxe ), typeof( WarAxe ), typeof( Club ),
typeof( Mace ), typeof( Maul ), typeof( WarHammer ),
typeof( WarMace ), typeof( Bardiche ), typeof( Halberd ),
typeof( Spear ), typeof( Rapier ), typeof( Pitchfork ),
typeof( WarFork ), typeof( BlackStaff ), typeof( GnarledStaff ),
typeof( QuarterStaff ), typeof( Broadsword ), typeof( Cutlass ),
typeof( Katana ), typeof( Kryss ), typeof( Longsword ),
typeof( Scimitar ), typeof( VikingSword ), typeof( Pickaxe ),
typeof( HammerPick ), typeof( ButcherKnife ), typeof( Cleaver ),
typeof( Dagger ), typeof( SkinningKnife ), typeof( ShepherdsCrook ),
typeof( Scythe ), typeof( Pike ), typeof( Whip )
};
public static Type[] WeaponTypes{ get{ return m_WeaponTypes; } }
private static Type[] m_RangedWeaponTypes = new Type[]
{
typeof( Bow ), typeof( Crossbow ), typeof( HeavyCrossbow )
};
public static Type[] RangedWeaponTypes{ get{ return m_RangedWeaponTypes; } }
private static Type[] m_ArmorTypes = new Type[]
{
typeof( BoneArms ), typeof( BoneChest ), typeof( BoneGloves ),
typeof( BoneLegs ), typeof( BoneHelm ), typeof( ChainChest ),
typeof( ChainLegs ), typeof( ChainCoif ), typeof( Bascinet ),
typeof( CloseHelm ), typeof( Helmet ), typeof( NorseHelm ),
typeof( OrcHelm ), typeof( FemaleLeatherChest ), typeof( LeatherArms ),
typeof( LeatherBustierArms ), typeof( LeatherChest ), typeof( LeatherGloves ),
typeof( LeatherGorget ), typeof( LeatherLegs ), typeof( LeatherShorts ),
typeof( LeatherSkirt ), typeof( LeatherCap ), typeof( FemalePlateChest ),
typeof( PlateArms ), typeof( PlateChest ), typeof( PlateGloves ),
typeof( PlateGorget ), typeof( PlateHelm ), typeof( PlateLegs ),
typeof( RingmailArms ), typeof( RingmailChest ), typeof( RingmailGloves ),
typeof( RingmailLegs ), typeof( FemaleStuddedChest ), typeof( StuddedArms ),
typeof( StuddedBustierArms ), typeof( StuddedChest ), typeof( StuddedGloves ),
typeof( StuddedGorget ), typeof( StuddedLegs )
};
public static Type[] ArmorTypes{ get{ return m_ArmorTypes; } }
private static Type[] m_ShieldTypes = new Type[]
{
typeof( BronzeShield ), typeof( Buckler ), typeof( HeaterShield ),
typeof( MetalShield ), typeof( MetalKiteShield ), typeof( WoodenKiteShield ),
typeof( WoodenShield ), typeof( ChaosShield ), typeof( OrderShield )
};
public static Type[] ShieldTypes{ get{ return m_ShieldTypes; } }
private static Type[] m_GemTypes = new Type[]
{
typeof( Amber ), typeof( Amethyst ), typeof( Citrine ),
typeof( Diamond ), typeof( Emerald ), typeof( Ruby ),
typeof( Sapphire ), typeof( StarSapphire ), typeof( Tourmaline )
};
public static Type[] GemTypes{ get{ return m_GemTypes; } }
private static Type[] m_JewelryTypes = new Type[]
{
typeof( GoldRing ), typeof( GoldBracelet ),
typeof( SilverRing ), typeof( SilverBracelet )
};
public static Type[] JewelryTypes{ get{ return m_JewelryTypes; } }
private static Type[] m_RegTypes = new Type[]
{
typeof( BlackPearl ), typeof( Bloodmoss ), typeof( Garlic ),
typeof( Ginseng ), typeof( MandrakeRoot ), typeof( Nightshade ),
typeof( SulfurousAsh ), typeof( SpidersSilk )
};
public static Type[] RegTypes{ get{ return m_RegTypes; } }
private static Type[] m_LowPotionTypes = new Type[]
{
typeof( LesserHealPotion ), typeof( LesserCurePotion ), typeof( LesserPoisonPotion ),
typeof( RefreshPotion ), typeof( StrengthPotion ), typeof( AgilityPotion ),
typeof( LesserExplosionPotion ), typeof( NightSightPotion )
};
public static Type[] LowPotionTypes{ get{ return m_LowPotionTypes; } }
private static Type[] m_MedPotionTypes = new Type[]
{
typeof( HealPotion ), typeof( PoisonPotion ), typeof( CurePotion ),
typeof( ExplosionPotion ), typeof( GreaterAgilityPotion ), typeof( GreaterStrengthPotion ),
typeof( TotalRefreshPotion )
};
public static Type[] MedPotionTypes{ get{ return m_MedPotionTypes; } }
private static Type[] m_HighPotionTypes = new Type[]
{
typeof( GreaterCurePotion ), typeof( GreaterExplosionPotion ), typeof( GreaterHealPotion ),
typeof( GreaterCurePotion ), typeof( GreaterExplosionPotion ), typeof( GreaterHealPotion ),
typeof( GreaterPoisonPotion ), typeof( DeadlyPoisonPotion )
};
public static Type[] HighPotionTypes{ get{ return m_HighPotionTypes; } }
private static Type[] m_InstrumentTypes = new Type[]
{
typeof( Drums ), typeof( Harp ), typeof( LapHarp ),
typeof( Lute ), typeof( Tambourine ), typeof( TambourineTassel ),
typeof( Horn ), typeof( Flute ), typeof( Pipes )
};
public static Type[] InstrumentTypes{ get{ return m_InstrumentTypes; } }
private static Type[] m_RegularScrollTypes = new Type[]
{
typeof( ReactiveArmorScroll ), typeof( ClumsyScroll ), typeof( CreateFoodScroll ), typeof( FeeblemindScroll ),
typeof( HealScroll ), typeof( MagicArrowScroll ), typeof( NightSightScroll ), typeof( WeakenScroll ),
typeof( AgilityScroll ), typeof( CunningScroll ), typeof( CureScroll ), typeof( HarmScroll ),
typeof( MagicTrapScroll ), typeof( MagicUnTrapScroll ), typeof( ProtectionScroll ), typeof( StrengthScroll ),
typeof( BlessScroll ), typeof( FireballScroll ), typeof( MagicLockScroll ), typeof( PoisonScroll ),
typeof( TelekinisisScroll ), typeof( TeleportScroll ), typeof( UnlockScroll ), typeof( WallOfStoneScroll ),
typeof( ArchCureScroll ), typeof( ArchProtectionScroll ), typeof( CurseScroll ), typeof( FireFieldScroll ),
typeof( GreaterHealScroll ), typeof( LightningScroll ), typeof( ManaDrainScroll ), typeof( RecallScroll ),
typeof( BladeSpiritsScroll ), typeof( DispelFieldScroll ), typeof( IncognitoScroll ), typeof( MagicReflectScroll ),
typeof( MindBlastScroll ), typeof( ParalyzeScroll ), typeof( PoisonFieldScroll ), typeof( SummonCreatureScroll ),
typeof( DispelScroll ), typeof( EnergyBoltScroll ), typeof( ExplosionScroll ), typeof( InvisibilityScroll ),
typeof( MarkScroll ), typeof( MassCurseScroll ), typeof( ParalyzeFieldScroll ), typeof( RevealScroll ),
typeof( ChainLightningScroll ), typeof( EnergyFieldScroll ), typeof( FlamestrikeScroll ), typeof( GateTravelScroll ),
typeof( ManaVampireScroll ), typeof( MassDispelScroll ), typeof( MeteorSwarmScroll ), typeof( PolymorphScroll ),
typeof( EarthquakeScroll ), typeof( EnergyVortexScroll ), typeof( ResurrectionScroll ), typeof( SummonAirElementalScroll ),
typeof( SummonDaemonScroll ), typeof( SummonEarthElementalScroll ), typeof( SummonFireElementalScroll ), typeof( SummonWaterElementalScroll )
};
public static Type[] RegularScrollTypes{ get{ return m_RegularScrollTypes; } }
private static Type[] m_WandTypes = new Type[]
{
typeof( ClumsyWand ), typeof( FeebleWand ), typeof( FireballWand ),
typeof( GreaterHealWand ), typeof( HarmWand ), typeof( HealWand ),
typeof( LightningWand ), typeof( MagicArrowWand ), typeof( RecallWand ),
typeof( ManaDrainWand ), typeof( WeaknessWand ), typeof( MarkWand ),
typeof( RemoveTrapWand ), typeof( UnlockWand ),
typeof( ClumsyWand ), typeof( FeebleWand ), typeof( FireballWand ),
typeof( GreaterHealWand ), typeof( HarmWand ), typeof( HealWand ),
typeof( LightningWand ), typeof( MagicArrowWand ), typeof( RecallWand ),
typeof( ManaDrainWand ), typeof( WeaknessWand ), typeof( MarkWand ),
typeof( RemoveTrapWand ), typeof( UnlockWand ),
typeof( ResurrectionWand )
};
public static Type[] WandTypes{ get{ return m_WandTypes; } }
private static Type[] m_ClothingTypes = new Type[]
{
typeof( Bonnet ), typeof( Cap ), typeof( FeatheredHat ),
typeof( FloppyHat ), typeof( JesterHat ), typeof( Surcoat ),
typeof( SkullCap ), typeof( StrawHat ), typeof( TallStrawHat ),
typeof( TricorneHat ), typeof( WideBrimHat ), typeof( WizardsHat ),
typeof( Bandana ), typeof( BearMask ), typeof( DeerMask ),
typeof( Hood ),
typeof( Boots ), typeof( Shoes ), typeof( ThighBoots ),
typeof( Sandals ),
typeof( Boots ), typeof( Shoes ), typeof( ThighBoots ),
typeof( Sandals ),
typeof( Boots ), typeof( Shoes ), typeof( ThighBoots ),
typeof( Sandals ),
typeof( ShortPants ), typeof( LongPants ), typeof( Kilt ),
typeof( Skirt ),
typeof( ShortPants ), typeof( LongPants ), typeof( Kilt ),
typeof( Skirt ),
typeof( ShortPants ), typeof( LongPants ), typeof( Kilt ),
typeof( Skirt ),
typeof( Doublet ), typeof( JesterSuit ), typeof( Tunic ),
typeof( Shirt ), typeof( FancyShirt ),
typeof( Doublet ), typeof( JesterSuit ), typeof( Tunic ),
typeof( Shirt ), typeof( FancyShirt ),
typeof( Doublet ), typeof( JesterSuit ), typeof( Tunic ),
typeof( Shirt ), typeof( FancyShirt ),
typeof( FancyDress ), typeof( PlainDress ), typeof( Robe ),
typeof( Robe ), typeof( Cloak ), typeof( BodySash ),
typeof( FancyDress ), typeof( PlainDress ), typeof( Robe ),
typeof( Robe ), typeof( Cloak ), typeof( BodySash ),
typeof( FullApron ), typeof( HalfApron )
};
public static Type[] ClothingTypes{ get{ return m_ClothingTypes; } }
private static Type[] m_BookTypes = new Type[]
{
typeof( BlueBook ),
typeof( BrownBook ),
typeof( Codex ),
typeof( Diary ),
typeof( Grimoire ),
typeof( Journal ),
typeof( Lexicon ),
typeof( RedBook ),
typeof( Spellbook ),
typeof( TanBook ),
typeof( Tome )
};
public static Type[] BookTypes{ get{ return m_BookTypes; } }
private static Type[] m_ToolTypes = new Type[]
{
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ),
typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ),
typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ),
typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ),
typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ),
typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ),
typeof( Skillet ),
typeof( FlourSifter ),
typeof( RollingPin ),
typeof( Skillet ),
typeof( FlourSifter ),
typeof( RollingPin ),
typeof( Skillet ),
typeof( FlourSifter ),
typeof( RollingPin ),
typeof( Skillet ),
typeof( FlourSifter ),
typeof( SmoothingPlane ),
typeof( DovetailSaw ),
typeof( DrawKnife ),
typeof( Froe ),
typeof( Hammer ),
typeof( Inshave ),
typeof( JointingPlane ),
typeof( MouldingPlane ),
typeof( Nails ),
typeof( Saw ),
typeof( Scorp ),
typeof( Tongs ),
typeof( SledgeHammer ),
typeof( SmithHammer ),
typeof( Tongs ),
typeof( SledgeHammer ),
typeof( SmithHammer ),
typeof( Tongs ),
typeof( SledgeHammer ),
typeof( SmithHammer ),
typeof( Tongs ),
typeof( SmithHammer )
};
public static Type[] ToolTypes{ get{ return m_ToolTypes; } }
private static Type[] m_CraftTypes = new Type[]
{
typeof( Beeswax ),
typeof( BlankScroll ),
typeof( BoltOfCloth ),
typeof( Bottle ),
typeof( Cloth ),
typeof( DarkYarn ),
typeof( Feather ),
typeof( IronIngot ),
typeof( Leather ),
typeof( LightYarn ),
typeof( Shaft ),
typeof( SpoolOfThread ),
typeof( UncutCloth ),
typeof( WoodBoard )
};
public static Type[] CraftTypes{ get{ return m_CraftTypes; } }
private static Type[] m_MiscTypes = new Type[]
{
typeof( Arrow ), typeof( Arrow ), typeof( Arrow ), typeof( Arrow ),
typeof( BigBag ), typeof( Backpack ), typeof( Backpack ), typeof( Backpack ),
typeof( BigBag ), typeof( Bag ), typeof( Bag ), typeof( Bag ),
typeof( Bandage ), typeof( Bandage ), typeof( Bandage ), typeof( Bandage ),
typeof( BedRolled ), typeof( BedRolled ), typeof( BedRolled ), typeof( BedRolled ),
typeof( Bolt ), typeof( Bolt ), typeof( Bolt ), typeof( Bolt ),
typeof( Sausage ), typeof( FrenchBread ), typeof( BreadLoaf ), typeof( Ribs ),
typeof( Candle ), typeof( Candle ), typeof( Candle ), typeof( Candle ),
typeof( SlabOfBacon ), typeof( CheeseWedge ), typeof( FishSteak ), typeof( CheeseWheel ),
typeof( Ham ), typeof( CookedBird ),
typeof( FishingPole ), typeof( FishingPole ), typeof( FishingPole ), typeof( FishingPole ),
typeof( Kindling ), typeof( Kindling ), typeof( Kindling ), typeof( Kindling ),
typeof( Lantern ), typeof( Lantern ), typeof( Lantern ), typeof( Lantern ),
typeof( Lockpick ), typeof( Lockpick ), typeof( Lockpick ), typeof( Lockpick ),
typeof( OilCloth ), typeof( OilCloth ), typeof( OilCloth ), typeof( OilCloth ),
typeof( BigBag ), typeof( Pouch ), typeof( Pouch ), typeof( Pouch ),
typeof( Scissors ), typeof( Scissors ), typeof( Scissors ), typeof( Scissors ),
typeof( Sextant ), typeof( Sextant ), typeof( Sextant ), typeof( Sextant ),
typeof( SmallCrate ), typeof( SmallCrate ), typeof( SmallCrate ), typeof( SmallCrate ),
typeof( Spyglass ), typeof( Spyglass ), typeof( Spyglass ), typeof( Spyglass ),
typeof( Torch ), typeof( Torch ), typeof( Torch ), typeof( Torch ),
typeof( WoodenBox ), typeof( WoodenBox ), typeof( WoodenBox ), typeof( WoodenBox ),
typeof( Axle ),
typeof( AxleGears ),
typeof( ClockFrame ),
typeof( ClockParts ),
typeof( ClockRight ),
typeof( ClockLeft ),
typeof( Gears ),
typeof( Hinge ),
typeof( SextantParts ),
typeof( Springs ),
typeof( Fork ),
typeof( Spoon ),
typeof( Knife ),
typeof( Plate ),
typeof( CeramicMug ),
typeof( PewterMug ),
typeof( Goblet ),
typeof( Glass ),
typeof( GlassBottle ),
typeof( GlassMug ),
typeof( Pitcher )
};
public static Type[] MiscTypes{ get{ return m_MiscTypes; } }
private static Type[] m_Rares = new Type[]
{
typeof( BottleOfAcid ), typeof( SkeletonKeys )
};
public static Type[] Rares{ get{ return m_Rares; } }
// ------------------------------------------------------------------------------------------------
private static Type[] m_CategoryA = new Type[]
{
typeof( IronBrazierShort ), typeof( IronBrazier ), typeof( IronBrazierStand ),
typeof( IronCandle ), typeof( IronCandelabra ), typeof( IronCandelabraStand )
};
public static Type[] CategoryA{ get{ return m_CategoryA; } }
private static Type[] m_CategoryB = new Type[]
{
typeof( TrophyFish ), typeof( TrophyKodiak ), typeof( TrophyGargoyle ),
typeof( TrophyBear ), typeof( TrophyLizard ), typeof( TrophyMinotaur ),
typeof( TrophyDeer ), typeof( TrophyLizardman ), typeof( TrophyGoblin ),
typeof( TrophyApe ), typeof( TrophyNightmare ), typeof( TrophyMinotaurLord ),
typeof( TrophyOrc ), typeof( TrophyOgre ), typeof( TrophyDragon ),
typeof( TrophyPolarBear ), typeof( TrophyRatman ), typeof( TrophyDaemon ),
typeof( TrophyTroll ), typeof( TrophyEttin ), typeof( TrophyBoard ),
typeof( TrophySnowBear ), typeof( TrophyOgreLord ), typeof( TrophyBoard ),
typeof( TrophyCaveBear ), typeof( TrophyCyclops ), typeof( TrophyBoard )
};
public static Type[] CategoryB{ get{ return m_CategoryB; } }
// ------------------------------------------------------------------------------------------------
#endregion
#region Accessors
public static BaseWand RandomWand()
{
return Construct( m_WandTypes ) as BaseWand;
}
public static BaseClothing RandomClothing()
{
return Construct( m_ClothingTypes ) as BaseClothing;
}
public static BaseWeapon RandomRangedWeapon()
{
return Construct( m_RangedWeaponTypes ) as BaseWeapon;
}
public static BaseWeapon RandomWeapon()
{
return Construct( m_WeaponTypes ) as BaseWeapon;
}
public static BaseJewel RandomJewelry()
{
return Construct( m_JewelryTypes ) as BaseJewel;
}
public static BaseArmor RandomArmor()
{
return Construct( m_ArmorTypes ) as BaseArmor;
}
public static BaseShield RandomShield()
{
return Construct( m_ShieldTypes ) as BaseShield;
}
public static BaseArmor RandomArmorOrShield()
{
return Construct( m_ArmorTypes, m_ShieldTypes ) as BaseArmor;
}
public static Item RandomArmorOrShieldOrWeapon()
{
return Construct( m_WeaponTypes, m_RangedWeaponTypes, m_ArmorTypes, m_ShieldTypes );
}
public static Item RandomLowPotion()
{
return Construct( m_LowPotionTypes );
}
public static Item RandomMedPotion()
{
return Construct( m_MedPotionTypes );
}
public static Item RandomHighPotion()
{
return Construct( m_HighPotionTypes );
}
public static Item RandomTool()
{
return Construct( m_ToolTypes );
}
public static Item RandomBook()
{
return Construct( m_BookTypes );
}
public static Item RandomRare()
{
return Construct( m_Rares );
}
public static Item RandomProvisions()
{
Item item = null;
switch ( Utility.Random( 32 ) )
{
case 0:
case 1: item = new Bandage(); break;
case 2:
case 3: item = new Arrow(); break;
case 4:
case 5: item = new Bolt(); break;
case 6:
case 7: item = new Candle(); break;
case 8:
case 9: item = new Torch(); break;
case 10:
case 11: item = new Lantern(); break;
case 12: item = new Sausage(); break;
case 13: item = new FrenchBread(); break;
case 14: item = new BreadLoaf(); break;
case 15: item = new Ribs(); break;
case 16: item = new SlabOfBacon(); break;
case 17: item = new CheeseWedge(); break;
case 18: item = new FishSteak(); break;
case 19: item = new CheeseWheel(); break;
case 20: item = new Ham(); break;
case 21: item = new CookedBird(); break;
case 22:
case 23:
case 24: item = new BeverageBottle( BeverageType.Ale ); break;
case 25:
case 26:
case 27: item = new BeverageBottle( BeverageType.Wine ); break;
case 28:
case 29: item = new BeverageBottle( BeverageType.Liquor ); break;
case 30:
case 31: item = new Jug( BeverageType.Cider ); break;
}
DungeonFood( item );
return item;
}
public static Item RandomCraft()
{
return Construct( m_CraftTypes );
}
public static Item RandomMisc()
{
Item item = Construct( m_MiscTypes );
DungeonFood( item );
return item;
}
public static Item RandomOdd()
{
Item item = null;
switch ( Utility.Random( 2 ) )
{
case 0: item = Construct( m_CategoryA ); break;
case 1: item = Construct( m_CategoryB ); break;
}
return item;
}
public static Item RandomGem()
{
return Construct( m_GemTypes );
}
public static Item RandomReagent()
{
return Construct( m_RegTypes );
}
public static BaseInstrument RandomInstrument()
{
return Construct( m_InstrumentTypes ) as BaseInstrument;
}
public static SpellScroll RandomScroll( int minIndex, int maxIndex, SpellbookType type )
{
Type[] types = m_RegularScrollTypes;
return Construct( types, Utility.RandomMinMax( minIndex, maxIndex ) ) as SpellScroll;
}
#endregion
public static void DungeonFood( Item item )
{
if ( item is Sausage ){ item.Name = "smoked sausage"; item.Hue = 0x4A2; }
else if ( item is FrenchBread ){ item.Name = "stale bread"; item.Hue = 0x4A2; }
else if ( item is BreadLoaf ){ item.Name = "stale bread"; item.Hue = 0x4A2; }
else if ( item is Ribs ){ item.Name = "smoked ribs"; item.Hue = 0x4A2; item.ItemID = 0x9F1; }
else if ( item is SlabOfBacon ){ item.Name = "smoked bacon"; item.Hue = 0x4A2; }
else if ( item is CheeseWedge ){ item.Name = "moldy cheese"; item.Hue = 0x49A; }
else if ( item is FishSteak ){ item.Name = "smoked fish"; item.Hue = 0x96D; }
else if ( item is CheeseWheel ){ item.Name = "moldy cheese"; item.Hue = 0x49A; }
else if ( item is Ham ){ item.Name = "smoked ham"; item.Hue = 0x49C; item.ItemID = 0x96F; }
else if ( item is CookedBird ){ item.Name = "smoked bird"; item.Hue = 0x49E; }
}
#region Construction methods
public static Item Construct( Type type )
{
try
{
return Activator.CreateInstance( type ) as Item;
}
catch
{
return null;
}
}
public static Item Construct( Type[] types )
{
if ( types.Length > 0 )
return Construct( types, Utility.Random( types.Length ) );
return null;
}
public static Item Construct( Type[] types, int index )
{
if ( index >= 0 && index < types.Length )
return Construct( types[index] );
return null;
}
public static Item Construct( params Type[][] types )
{
int totalLength = 0;
for ( int i = 0; i < types.Length; ++i )
totalLength += types[i].Length;
if ( totalLength > 0 )
{
int index = Utility.Random( totalLength );
for ( int i = 0; i < types.Length; ++i )
{
if ( index >= 0 && index < types[i].Length )
return Construct( types[i][index] );
index -= types[i].Length;
}
}
return null;
}
#endregion
}
}