本文整理汇总了C#中Server.Engines.Harvest.HarvestDefinition类的典型用法代码示例。如果您正苦于以下问题:C# HarvestDefinition类的具体用法?C# HarvestDefinition怎么用?C# HarvestDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HarvestDefinition类属于Server.Engines.Harvest命名空间,在下文中一共展示了HarvestDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Consume
public void Consume(HarvestDefinition def, int amount, Mobile from)
{
CheckRespawn();
if (m_Current == m_Maximum)
{
double min = def.MinRespawn.TotalMinutes;
double max = def.MaxRespawn.TotalMinutes;
double rnd = Utility.RandomDouble();
m_Current = m_Maximum - amount;
double minutes = min + (rnd * (max - min));
if (def.RaceBonus && from.Race == Race.Elf) //def.RaceBonus = Core.ML
minutes *= .75; //25% off the time.
m_NextRespawn = DateTime.Now + TimeSpan.FromMinutes(minutes);
}
else
{
m_Current -= amount;
}
if (m_Current < 0)
m_Current = 0;
}
示例2: HarvestBank
public HarvestBank( HarvestDefinition def, HarvestVein defaultVein )
{
m_Maximum = Utility.RandomMinMax( def.MinTotal, def.MaxTotal );
m_Current = m_Maximum;
m_DefaultVein = defaultVein;
m_Vein = m_DefaultVein;
}
示例3: CheckRange
public virtual bool CheckRange( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, bool timed )
{
bool inRange = ( from.Map == map && from.InRange( loc, def.MaxRange ) );
if ( !inRange )
def.SendMessageTo( from, timed ? def.TimedOutOfRangeMessage : def.OutOfRangeMessage );
return inRange;
}
示例4: Fishing
private Fishing()
{
#region Fishing
var fish = new HarvestDefinition
{
// Resource banks are every 8x8 tiles
BankWidth = 8,
BankHeight = 8,
// Every bank holds from 5 to 15 fish
MinTotal = 5,
MaxTotal = 15,
// A resource bank will respawn its content every 15 to 25 minutes
MinRespawn = TimeSpan.FromMinutes(15.0),
MaxRespawn = TimeSpan.FromMinutes(25.0),
// Skill checking is done on the Fishing skill
Skill = SkillName.Fishing,
// Set the list of harvestable tiles
Tiles = m_WaterTiles,
// Players must be within N tiles to harvest
RangedTiles = true,
MaxRange = 3,
// One fish per harvest action
ConsumedPerHarvest = 1,
ConsumedPerFeluccaHarvest = 1,
// The fishing
EffectActions = new[] {12},
EffectSounds = new int[0],
EffectCounts = new[] {1},
EffectDelay = TimeSpan.Zero,
EffectSoundDelay = TimeSpan.FromSeconds(8.0),
NoResourcesMessage = 503172,
FailMessage = 503171,
TimedOutOfRangeMessage = 500976,
OutOfRangeMessage = 500976,
PackFullMessage = 503176,
ToolBrokeMessage = 503174
};
var res = new[] {new HarvestResource(Expansion.None, 00.0, 00.0, 120.0, 1043297, typeof(Fish))};
var veins = new[] {new HarvestVein(Expansion.None, 120.0, 0.0, res[0], null)};
fish.Resources = res;
fish.Veins = veins;
fish.PlaceAtFeetIfFull = true;
fish.BonusResources = new[]
{
new BonusHarvestResource(Expansion.ML, 0, 99.4, null, null), //set to same chance as mining ml gems
new BonusHarvestResource(Expansion.ML, 80.0, 0.6, 1072597, typeof(WhitePearl))
};
Fish = fish;
Definitions.Add(Fish);
#endregion
}
示例5: HarvestSoundTimer
public HarvestSoundTimer( Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked, bool last ) : base( def.EffectSoundDelay )
{
m_From = from;
m_Tool = tool;
m_System = system;
m_Definition = def;
m_ToHarvest = toHarvest;
m_Locked = locked;
m_Last = last;
}
示例6: HarvestTimer
public HarvestTimer( Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked ) : base( TimeSpan.Zero, def.EffectDelay )
{
m_From = from;
m_Tool = tool;
m_System = system;
m_Definition = def;
m_ToHarvest = toHarvest;
m_Locked = locked;
m_Count = Utility.RandomList( def.EffectCounts );
}
示例7: HarvestBank
public HarvestBank( HarvestDefinition def, HarvestVein defaultVein, double chanceToFallback )
{
m_Maximum = Utility.RandomMinMax( def.MinTotal, def.MaxTotal );
m_Current = m_Maximum;
m_DefaultVein = defaultVein;
m_Vein = m_DefaultVein;
m_ChanceToFallback = chanceToFallback;
m_Definition = def;
}
示例8: CheckResources
public virtual bool CheckResources( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, bool timed )
{
HarvestBank bank = def.GetBank( map, loc.X, loc.Y );
bool available = ( bank != null && bank.Current >= def.ConsumedPerHarvest );
if ( !available )
def.SendMessageTo( from, timed ? def.DoubleHarvestMessage : def.NoResourcesMessage );
return available;
}
示例9: GetLock
public virtual object GetLock(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
{
/* Here we prevent multiple harvesting.
*
* Some options:
* - 'return tool;' : This will allow the player to harvest more than once concurrently, but only if they use multiple tools. This seems to be as OSI.
* - 'return GetType();' : This will disallow multiple harvesting of the same type. That is, we couldn't mine more than once concurrently, but we could be both mining and lumberjacking.
* - 'return typeof( HarvestSystem );' : This will completely restrict concurrent harvesting.
*/
return tool;
}
示例10: HarvestTimer
public HarvestTimer(Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked)
: base(TimeSpan.Zero, def.EffectDelay)
{
m_From = from;
m_Tool = tool;
m_System = system;
m_Definition = def;
m_ToHarvest = toHarvest;
m_Locked = locked;
//m_Count = Utility.RandomList( def.EffectCounts );
m_Count = 1 + Utility.Random(1, 5);
//Update the action
if (from is PlayerMobile)
((PlayerMobile)from).ResetPlayerAction(this);
}
示例11: Consume
public void Consume( HarvestDefinition def, int amount )
{
CheckRespawn();
if ( m_Current == m_Maximum )
{
int min = (int)def.MinRespawn.TotalSeconds;
int max = (int)def.MaxRespawn.TotalSeconds;
m_Current = m_Maximum - amount;
m_NextRespawn = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( min, max ) );
}
else
{
m_Current -= amount;
}
if ( m_Current < 0 )
m_Current = 0;
}
示例12: Consume
public void Consume( HarvestDefinition def, int amount )
{
CheckRespawn();
if ( m_Current == m_Maximum )
{
double min = def.MinRespawn.TotalMinutes;
double max = def.MaxRespawn.TotalMinutes;
double rnd = Utility.RandomDouble();
m_Current = m_Maximum - amount;
m_NextRespawn = DateTime.Now + TimeSpan.FromMinutes( min + (rnd * (max - min)) );
}
else
{
m_Current -= amount;
}
if ( m_Current < 0 )
m_Current = 0;
}
示例13: OnHarvestFinished
public override void OnHarvestFinished( Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested)
{
/* include this part for rare extras
// modded by greywolf for random items coming in
double skillvaluelj = killerguy.Skills[SkillName.Magery].Base;
int i_itemid = (int)(killerguy.Skills[SkillName.ItemID].Base/10);
if ((Utility.RandomMinMax( 1, 1500 ) <= (1 + i_itemid)) && (skillvaluelj >= 70.1))
{
switch (Utility.RandomMinMax( 0, 10 ))
{
case 1 : default: from.AddToBackpack(new Kindling()); from.SendMessage ("you find something wedged in the tree, a weird peice of wood ");break;
case 2 : from.AddToBackpack(new BarkFragment()); from.SendMessage ("you find something wedged in the tree, a peice of bark ");break;
case 3 : from.AddToBackpack(new LuminescentFungi()); from.SendMessage ("you find something wedged in the tree, some fungi ");break;
case 4 : from.AddToBackpack(new ParasiticPlant()); from.SendMessage ("you find something wedged in the tree, a weird looking plant");break;
case 5 : from.AddToBackpack(new DiseasedBark()); from.SendMessage ("you find something wedged in the tree, some weird looking bark ");break;
}
}
*/
}
示例14: DoHarvestingEffect
public virtual void DoHarvestingEffect( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc )
{
from.Direction = from.GetDirectionTo( loc );
if ( !from.Mounted )
from.Animate( Utility.RandomList( def.EffectActions ), 5, 1, true, false, 0 );
}
示例15: Lumberjacking
private Lumberjacking()
{
HarvestResource[] res;
HarvestVein[] veins;
#region Lumberjacking
HarvestDefinition lumber = new HarvestDefinition();
// Resource banks are every 4x3 tiles
lumber.BankWidth = 4;
lumber.BankHeight = 3;
// Every bank holds from 20 to 45 logs
lumber.MinTotal = 20;
lumber.MaxTotal = 45;
// A resource bank will respawn its content every 20 to 30 minutes
lumber.MinRespawn = TimeSpan.FromMinutes(20.0);
lumber.MaxRespawn = TimeSpan.FromMinutes(30.0);
// Skill checking is done on the Lumberjacking skill
lumber.Skill = SkillName.Lumberjacking;
// Set the list of harvestable tiles
lumber.Tiles = m_TreeTiles;
// Players must be within 2 tiles to harvest
lumber.MaxRange = 2;
// Ten logs per harvest action
lumber.ConsumedPerHarvest = 10;
lumber.ConsumedPerFeluccaHarvest = 20;
// The chopping effect
lumber.EffectActions = new int[] { 13 };
lumber.EffectSounds = new int[] { 0x13E };
lumber.EffectCounts = (Core.AOS ? new int[] { 1 } : new int[] { 1, 2, 2, 2, 3 });
lumber.EffectDelay = TimeSpan.FromSeconds(1.6);
lumber.EffectSoundDelay = TimeSpan.FromSeconds(0.9);
lumber.NoResourcesMessage = 500493; // There's not enough wood here to harvest.
lumber.FailMessage = 500495; // You hack at the tree for a while, but fail to produce any useable wood.
lumber.OutOfRangeMessage = 500446; // That is too far away.
lumber.PackFullMessage = 500497; // You can't place any wood into your backpack!
lumber.ToolBrokeMessage = 500499; // You broke your axe.
if (Core.ML)
{
res = new HarvestResource[]
{
new HarvestResource(00.0, 00.0, 100.0, 1072540, typeof(Log)),
new HarvestResource(65.0, 25.0, 105.0, 1072541, typeof(OakLog)),
new HarvestResource(80.0, 40.0, 120.0, 1072542, typeof(AshLog)),
new HarvestResource(95.0, 55.0, 135.0, 1072543, typeof(YewLog)),
new HarvestResource(100.0, 60.0, 140.0, 1072544, typeof(HeartwoodLog)),
new HarvestResource(100.0, 60.0, 140.0, 1072545, typeof(BloodwoodLog)),
new HarvestResource(100.0, 60.0, 140.0, 1072546, typeof(FrostwoodLog)),
};
veins = new HarvestVein[]
{
new HarvestVein(49.0, 0.0, res[0], null), // Ordinary Logs
new HarvestVein(30.0, 0.5, res[1], res[0]), // Oak
new HarvestVein(10.0, 0.5, res[2], res[0]), // Ash
new HarvestVein(05.0, 0.5, res[3], res[0]), // Yew
new HarvestVein(03.0, 0.5, res[4], res[0]), // Heartwood
new HarvestVein(02.0, 0.5, res[5], res[0]), // Bloodwood
new HarvestVein(01.0, 0.5, res[6], res[0]), // Frostwood
};
lumber.BonusResources = new BonusHarvestResource[]
{
new BonusHarvestResource(0, 83.9, null, null), //Nothing
new BonusHarvestResource(100, 10.0, 1072548, typeof(BarkFragment)),
new BonusHarvestResource(100, 03.0, 1072550, typeof(LuminescentFungi)),
new BonusHarvestResource(100, 02.0, 1072547, typeof(SwitchItem)),
new BonusHarvestResource(100, 01.0, 1072549, typeof(ParasiticPlant)),
new BonusHarvestResource(100, 00.1, 1072551, typeof(BrilliantAmber))
};
}
else
{
res = new HarvestResource[]
{
new HarvestResource(00.0, 00.0, 100.0, 500498, typeof(Log))
};
veins = new HarvestVein[]
{
new HarvestVein(100.0, 0.0, res[0], null)
};
}
lumber.Resources = res;
lumber.Veins = veins;
lumber.RaceBonus = Core.ML;
lumber.RandomizeVeins = Core.ML;
this.m_Definition = lumber;
//.........这里部分代码省略.........