namespace Server.Engines.Harvest
{
public class Mining : HarvestSystem
{
....
private HarvestDefinition m_OreAndStone, m_Sand, m_Grave;
public HarvestDefinition Grave
{
get { return m_Grave; }
}
public static void Initialize()
{
Array.Sort( m_GraveTiles );
}
private Mining()
{
....
#region GraveRobbing
HarvestDefinition grave = m_Grave = new HarvestDefinition();
grave.BankWidth = 2;
grave.BankHeight = 2;
grave.MinTotal = 1;
grave.MaxTotal = 2;
grave.MinRespawn = TimeSpan.FromMinutes( 20.0 );
grave.MaxRespawn = TimeSpan.FromMinutes( 30.0 );
grave.Skill = SkillName.Mining;
grave.Tiles = m_GraveTiles;
grave.MaxRange = 2;
grave.ConsumedPerHarvest = 1;
grave.ConsumedPerFeluccaHarvest = 1;
grave.EffectActions = new int[] { 11 };
grave.EffectSounds = new int[] { 0x125, 0x126 };
grave.EffectCounts = new int[] { 1, 2, 2, 2, 3 };
grave.EffectDelay = TimeSpan.FromSeconds( 1.6 );
grave.EffectSoundDelay = TimeSpan.FromSeconds( 0.9 );
grave.NoResourcesMessage = 501756; // Nothing worth taking..
grave.FailMessage = 503006; // Nothing visible happens..
grave.OutOfRangeMessage = 500446; // That is too far away.
grave.PackFullMessage = 500720; // You don't have enough room in your backpack!
grave.ToolBrokeMessage = 500499; // You broke your axe.
grave.PlaceAtFeetIfFull = true;
res = new HarvestResource[]
{
new HarvestResource( 020.0, 010.0, 150.0, "You put some bones in your backpack", typeof( Bone ), typeof( Revenant ) ),
new HarvestResource( 050.0, 030.0, 150.0, "You put some garlic in your backpack", typeof( Garlic ) ),
new HarvestResource( 050.0, 030.0, 150.0, "You put some spiders silk in your backpack", typeof( SpidersSilk ) ),
new HarvestResource( 050.0, 030.0, 150.0, "You put some blood moss in your backpack", typeof( Bloodmoss ) ),
new HarvestResource( 065.0, 040.0, 150.0, "You put some nightshade in your backpack", typeof( Nightshade ) ),
new HarvestResource( 065.0, 040.0, 150.0, "You put some mandrake root in your backpack", typeof( MandrakeRoot ) )
};
veins = new HarvestVein[]
{
new HarvestVein( 35.0, 0.0, res[0], res[0] ), // Bones
new HarvestVein( 15.0, 0.5, res[1], res[0] ), // ExecutionerCap
new HarvestVein( 15.0, 0.5, res[2], res[0] ), // SpidersSilk
new HarvestVein( 15.0, 0.5, res[3], res[0] ), // BloodMoss
new HarvestVein( 10.0, 0.5, res[4], res[0] ), // NightShade
new HarvestVein( 10.0, 0.5, res[5], res[0] ) // MandrakeRoot
};
grave.Resources = res;
grave.Veins = veins;
Definitions.Add( grave );
#endregion
}
public override void OnHarvestFinished( Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested )
{
....
else if( def == m_Grave )
{
int tileID; Map map; Point3D loc;
if( GetHarvestDetails( from, tool, harvested, out tileID, out map, out loc ) )
{
if( 0.15 > Utility.RandomDouble() )
{
HarvestResource res = vein.PrimaryResource;
if( res == resource )
{
try
{
Type chance; int num;
double miningskill = from.Skills[SkillName.Mining].Base;
if( 0.67 > Utility.RandomDouble() )
{
num = (((int)miningskill - 20) + Utility.Random( 40 )) / 20;
if( num < 0 )
num = 0;
else if( num > (Spirit.Length - 1) )
num = Spirit.Length - 1;
if( 0.90 > Utility.RandomDouble() )
{
chance = Spirit[num];
BaseCreature spawned = Activator.CreateInstance( chance, new object[] { } ) as BaseCreature;
if( spawned != null )
{
spawned.MoveToWorld( loc, map );
spawned.Say( "Who has disturbed me!" );
spawned.Combatant = from;
}
}
}
double stealingskill = from.Skills[SkillName.Stealing].Base;
if( (stealingskill > 60) ? (0.22 > Utility.RandomDouble()) : (0.17 > Utility.RandomDouble()) )
{
num = ((((int)stealingskill - 30) + Utility.Random( 11 )) / 7) + 1;
if( num < 0 )
num = 0;
else if( num > (GraveGoods.Length - 1) )
num = GraveGoods.Length - 1;
int found = Utility.Random( num );
int level = 1;
if( GraveGoods[found] == typeof( BonePile ) )
level = found + 1;
if( GraveGoods[found] == typeof( GraveTreasureChest ) )
level = found - 3;
BaseContainer goodies = Activator.CreateInstance( GraveGoods[found], new object[] { level } ) as BaseContainer;
if( goodies != null )
{
goodies.MoveToWorld( loc, map );
from.SendMessage( "You dig up something interesting" );
}
}
}
catch { }
}
}
}
}
}
private static int[] m_GraveTiles = new int[]
{
0x4ED3, 0x4EDF, 0x4EE0, 0x4EE1, 0x4EE2, 0x4EE8
};
private static Type[] m_Spirit = new Type[]
{
typeof( Zombie ),
typeof( Skeleton ),
typeof( Ghoul ),
typeof( Shade ),
typeof( Spectre ),
typeof( Wraith )
};
public static Type[] Spirit { get { return m_Spirit; } }
private static Type[] m_GraveGoods = new Type[]
{
typeof( BonePile ),
typeof( BonePile ),
typeof( BonePile ),
typeof( BonePile ),
typeof( GraveTreasureChest ),
typeof( GraveTreasureChest ),
typeof( GraveTreasureChest ),
typeof( GraveTreasureChest ),
typeof( GraveTreasureChest ),
typeof( GraveTreasureChest ),
};
public static Type[] GraveGoods { get { return m_GraveGoods; } }
}
}