本文整理汇总了C#中Server.Engines.Harvest.HarvestBank.Consume方法的典型用法代码示例。如果您正苦于以下问题:C# HarvestBank.Consume方法的具体用法?C# HarvestBank.Consume怎么用?C# HarvestBank.Consume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Engines.Harvest.HarvestBank
的用法示例。
在下文中一共展示了HarvestBank.Consume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnHarvestFinished
public override void OnHarvestFinished( Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested )
{
if ( tool is GargoylesPickaxe && def == m_OreAndStone && 0.1 > Utility.RandomDouble() )
{
HarvestResource res = vein.PrimaryResource;
if ( res == resource && res.Types.Length >= 3 )
{
try
{
Map map = from.Map;
if ( map == null )
return;
BaseCreature spawned = Activator.CreateInstance( res.Types[2], new object[]{ 25 } ) as BaseCreature;
if ( spawned != null )
{
int offset = Utility.Random( 8 ) * 2;
for ( int i = 0; i < m_Offsets.Length; i += 2 )
{
int x = from.X + m_Offsets[(offset + i) % m_Offsets.Length];
int y = from.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
if ( map.CanSpawnMobile( x, y, from.Z ) )
{
spawned.OnBeforeSpawn(new Point3D(x, y, from.Z), map);
spawned.MoveToWorld( new Point3D( x, y, from.Z ), map );
spawned.Combatant = from;
return;
}
else
{
int z = map.GetAverageZ( x, y );
if ( map.CanSpawnMobile( x, y, z ) )
{
spawned.OnBeforeSpawn(new Point3D(x, y, z), map);
spawned.MoveToWorld( new Point3D( x, y, z ), map );
spawned.Combatant = from;
return;
}
}
}
spawned.OnBeforeSpawn(from.Location, from.Map);
spawned.MoveToWorld( from.Location, from.Map );
spawned.Combatant = from;
}
}
catch
{
}
}
}
if (bank != null && bank.Vein != null && bank.Vein.PrimaryResource != null)
{
int bankAmount = bank.Current;
double skillReq = bank.Vein.PrimaryResource.ReqSkill;
if (skillReq >= 99.0 && bankAmount <= 13)
bank.Consume(def, bankAmount, from);
else if (skillReq >= 98.0 && bankAmount <= 12)
bank.Consume(def, bankAmount, from);
else if (skillReq >= 97.0 && bankAmount <= 10)
bank.Consume(def, bankAmount, from);
else if (skillReq >= 90.0 && bankAmount <= 8)
bank.Consume(def, bankAmount, from);
else if (skillReq >= 75.0 && bankAmount <= 6)
bank.Consume(def, bankAmount, from);
else if (skillReq >= 65.0 && bankAmount <= 4)
bank.Consume(def, bankAmount, from);
}
}