This commit is contained in:
mark 2007-12-17 20:41:34 +00:00
parent 7ad00dceac
commit 0b4c3b15d9
41 changed files with 976 additions and 144 deletions

View file

@ -278,19 +278,6 @@ namespace Server.Engines.Doom
{
Point3D loc = GetWorldLocation();
/*
Sector sec = map.GetSector( loc );
ArrayList regions = sec.Regions;
for ( int i = 0; playerCount == 0 && i < regions.Count; ++i )
{
Region reg = (Region)regions[i];
if ( reg != null && reg != m_Region && reg.Contains( loc ) )
playerCount = reg.GetPlayerCount();
}
*/
Region reg = Region.Find( loc, map ).GetRegion( "Doom Gauntlet" );
if ( reg != null )
@ -575,11 +562,11 @@ namespace Server.Engines.Doom
dealer.Female = false;
dealer.Hue = 0x8835;
ArrayList items = new ArrayList( dealer.Items );
List<Item> items = new List<Item>( dealer.Items );
for ( int i = 0; i < items.Count; ++i )
{
Item item = (Item)items[i];
Item item = items[i];
if ( item.Layer != Layer.ShopBuy && item.Layer != Layer.ShopResale && item.Layer != Layer.ShopSell )
item.Delete();

View file

@ -0,0 +1,31 @@
using System;
namespace Server.Engines.Harvest
{
public class BonusHarvestResource
{
private Type m_Type;
private double m_ReqSkill, m_Chance;
private TextDefinition m_SuccessMessage;
public Type Type { get { return m_Type; } set { m_Type = value; } }
public double ReqSkill { get { return m_ReqSkill; } set { m_ReqSkill = value; } }
public double Chance { get { return m_Chance; } set { m_Chance = value; } }
public TextDefinition SuccessMessage { get { return m_SuccessMessage; } }
public void SendSuccessTo( Mobile m )
{
TextDefinition.SendMessageTo( m, m_SuccessMessage );
}
public BonusHarvestResource( double reqSkill, double chance, TextDefinition message, Type type )
{
m_ReqSkill = reqSkill;
m_Chance = chance;
m_Type = type;
m_SuccessMessage = message;
}
}
}

View file

@ -9,6 +9,13 @@ namespace Server.Engines.Harvest
private DateTime m_NextRespawn;
private HarvestVein m_Vein, m_DefaultVein;
HarvestDefinition m_Definition;
public HarvestDefinition Definition
{
get { return m_Definition; }
}
public int Current
{
get
@ -46,23 +53,31 @@ namespace Server.Engines.Harvest
return;
m_Current = m_Maximum;
m_Vein = m_DefaultVein;
if ( m_Definition.RandomizeVeins )
{
m_Vein = m_Definition.GetVeinFrom( Utility.RandomDouble() );
}
else
{
m_Vein = m_DefaultVein;
}
}
public void Consume( HarvestDefinition def, int amount, Mobile from )
public void Consume( int amount, Mobile from )
{
CheckRespawn();
if ( m_Current == m_Maximum )
{
double min = def.MinRespawn.TotalMinutes;
double max = def.MaxRespawn.TotalMinutes;
double min = m_Definition.MinRespawn.TotalMinutes;
double max = m_Definition.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
if ( m_Definition.RaceBonus && from.Race == Race.Elf ) //def.RaceBonus = Core.ML
minutes *= .75; //25% off the time.
m_NextRespawn = DateTime.Now + TimeSpan.FromMinutes( minutes );
@ -82,6 +97,8 @@ namespace Server.Engines.Harvest
m_Current = m_Maximum;
m_DefaultVein = defaultVein;
m_Vein = m_DefaultVein;
m_Definition = def;
}
}
}

View file

@ -22,7 +22,9 @@ namespace Server.Engines.Harvest
private object m_NoResourcesMessage, m_OutOfRangeMessage, m_TimedOutOfRangeMessage, m_DoubleHarvestMessage, m_FailMessage, m_PackFullMessage, m_ToolBrokeMessage;
private HarvestResource[] m_Resources;
private HarvestVein[] m_Veins;
private BonusHarvestResource[] m_BonusResources;
private bool m_RaceBonus;
private bool m_RandomizeVeins;
public int BankWidth{ get{ return m_BankWidth; } set{ m_BankWidth = value; } }
public int BankHeight{ get{ return m_BankHeight; } set{ m_BankHeight = value; } }
@ -51,7 +53,9 @@ namespace Server.Engines.Harvest
public object ToolBrokeMessage{ get{ return m_ToolBrokeMessage; } set{ m_ToolBrokeMessage = value; } }
public HarvestResource[] Resources{ get{ return m_Resources; } set{ m_Resources = value; } }
public HarvestVein[] Veins{ get{ return m_Veins; } set{ m_Veins = value; } }
public BonusHarvestResource[] BonusResources{ get { return m_BonusResources; } set { m_BonusResources = value; } }
public bool RaceBonus { get { return m_RaceBonus; } set { m_RaceBonus = value; } }
public bool RandomizeVeins { get { return m_RandomizeVeins; } set { m_RandomizeVeins = value; } }
private Dictionary<Map, Dictionary<Point2D, HarvestBank>> m_BanksByMap;
@ -94,8 +98,27 @@ namespace Server.Engines.Harvest
if ( m_Veins.Length == 1 )
return m_Veins[0];
Random random = new Random( (x*17)+(y*11)+(map.MapID * 3) );
double randomValue = random.NextDouble() * 100;
double randomValue;
if ( m_RandomizeVeins )
{
randomValue = Utility.RandomDouble();
}
else
{
Random random = new Random( ( x * 17 ) + ( y * 11 ) + ( map.MapID * 3 ) );
randomValue = random.NextDouble();
}
return GetVeinFrom( randomValue );
}
public HarvestVein GetVeinFrom( double randomValue )
{
if ( m_Veins.Length == 1 )
return m_Veins[0];
randomValue *= 100;
for ( int i = 0; i < m_Veins.Length; ++i )
{
@ -108,6 +131,24 @@ namespace Server.Engines.Harvest
return null;
}
public BonusHarvestResource GetBonusResource()
{
if ( m_BonusResources == null )
return null;
double randomValue = Utility.RandomDouble() * 100;
for ( int i = 0; i < m_BonusResources.Length; ++i )
{
if ( randomValue <= m_BonusResources[i].Chance )
return m_BonusResources[i];
randomValue -= m_BonusResources[i].Chance;
}
return null;
}
public HarvestDefinition()
{
m_BanksByMap = new Dictionary<Map, Dictionary<Point2D, HarvestBank>>();

View file

@ -186,7 +186,7 @@ namespace Server.Engines.Harvest
item.Amount = amount;
}
bank.Consume( def, item.Amount, from );
bank.Consume( item.Amount, from );
if ( Give( from, item, def.PlaceAtFeetIfFull ) )
{
@ -198,6 +198,22 @@ namespace Server.Engines.Harvest
item.Delete();
}
BonusHarvestResource bonus = def.GetBonusResource();
if ( bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill )
{
Item bonusItem = Construct( bonus.Type, from );
if ( Give( from, bonusItem, true ) ) //Bonuses always allow placing at feet, even if pack is full irregrdless of def
{
bonus.SendSuccessTo( from );
}
else
{
item.Delete();
}
}
if ( tool is IUsesRemaining )
{
IUsesRemaining toolWithUses = (IUsesRemaining)tool;
@ -266,14 +282,14 @@ namespace Server.Engines.Harvest
if ( map == null )
return false;
ArrayList atFeet = new ArrayList();
List<Item> atFeet = new List<Item>();
foreach ( Item obj in m.GetItemsInRange( 0 ) )
atFeet.Add( obj );
for ( int i = 0; i < atFeet.Count; ++i )
{
Item check = (Item)atFeet[i];
Item check = atFeet[i];
if ( check.StackWith( m, item, false ) )
return true;

View file

@ -481,17 +481,23 @@ namespace Server.Engines.Harvest
Point3D loc;
if ( GetHarvestDetails( from, tool, toHarvest, out tileID, out map, out loc ) )
Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), new TimerStateCallback( Splash_Callback ), new object[]{ loc, map } );
Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ),
delegate
{
if( Core.ML )
from.RevealingAction();
Effects.SendLocationEffect( loc, map, 0x352D, 16, 4 );
Effects.PlaySound( loc, map, 0x364 );
} );
}
private void Splash_Callback( object state )
public override void OnHarvestFinished( Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested )
{
object[] args = (object[])state;
Point3D loc = (Point3D)args[0];
Map map = (Map)args[1];
base.OnHarvestFinished( from, tool, def, vein, bank, resource, harvested );
Effects.SendLocationEffect( loc, map, 0x352D, 16, 4 );
Effects.PlaySound( loc, map, 0x364 );
if ( Core.ML )
from.RevealingAction();
}
public override object GetLock( Mobile from, Item tool, HarvestDefinition def, object toHarvest )

View file

@ -62,7 +62,7 @@ namespace Server.Engines.Harvest
// The chopping effect
lumber.EffectActions = new int[]{ 13 };
lumber.EffectSounds = new int[]{ 0x13E };
lumber.EffectCounts = new int[]{ 1, 2, 2, 2, 3 };
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 );
@ -72,20 +72,59 @@ namespace Server.Engines.Harvest
lumber.PackFullMessage = 500497; // You can't place any wood into your backpack!
lumber.ToolBrokeMessage = 500499; // You broke your axe.
res = new HarvestResource[]
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( 58.4, 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( 01.0, 0.5, res[3], res[0] ), // Yew
new HarvestVein( 00.3, 0.5, res[4], res[0] ), // Heartwood
new HarvestVein( 00.2, 0.5, res[5], res[0] ), // Bloodwood
new HarvestVein( 00.1, 0.5, res[6], res[0] ), // Frostwood
};
lumber.BonusResoucres = 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[]
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;
m_Definition = lumber;
Definitions.Add( lumber );
@ -125,6 +164,14 @@ namespace Server.Engines.Harvest
from.SendLocalizedMessage( 500489 ); // You can't use an axe on that.
}
public override void OnHarvestStarted( Mobile from, Item tool, HarvestDefinition def, object toHarvest )
{
base.OnHarvestStarted( from, tool, def, toHarvest );
if( Core.ML )
from.RevealingAction();
}
public static void Initialize()
{
Array.Sort( m_TreeTiles );

View file

@ -110,7 +110,22 @@ namespace Server.Engines.Harvest
oreAndStone.Resources = res;
oreAndStone.Veins = veins;
if ( Core.ML )
{
oreAndStone.BonusResoucres = new BonusHarvestResource[]
{
new BonusHarvestResource( 0, 99.8998, null, null ), //Nothing //Note: Rounded the below to .0167 instead of 1/6th of a %. Close enough
new BonusHarvestResource( 100, .0167, 1072562, typeof( BlueDiamond ) ),
new BonusHarvestResource( 100, .0167, 1072567, typeof( DarkSapphire ) ),
new BonusHarvestResource( 100, .0167, 1072570, typeof( EcruCitrine ) ),
new BonusHarvestResource( 100, .0167, 1072564, typeof( FireRuby ) ),
new BonusHarvestResource( 100, .0167, 1072566, typeof( PerfectEmerald ) ),
new BonusHarvestResource( 100, .0167, 1072568, typeof( Turquoise ) )
};
}
oreAndStone.RaceBonus = Core.ML;
oreAndStone.RandomizeVeins = Core.ML;
Definitions.Add( oreAndStone );
#endregion
@ -330,6 +345,14 @@ namespace Server.Engines.Harvest
return true;
}
public override void OnHarvestStarted( Mobile from, Item tool, HarvestDefinition def, object toHarvest )
{
base.OnHarvestStarted( from, tool, def, toHarvest );
if ( Core.ML )
from.RevealingAction();
}
public override void OnBadHarvestTarget( Mobile from, Item tool, object toHarvest )
{
if ( toHarvest is LandTarget )

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Engines.VeteranRewards
{
@ -7,22 +8,22 @@ namespace Server.Engines.VeteranRewards
{
private int m_Name;
private string m_NameString;
private ArrayList m_Entries;
private List<RewardEntry> m_Entries;
public int Name{ get{ return m_Name; } }
public string NameString{ get{ return m_NameString; } }
public ArrayList Entries{ get{ return m_Entries; } }
public List<RewardEntry> Entries { get { return m_Entries; } }
public RewardCategory( int name )
{
m_Name = name;
m_Entries = new ArrayList();
m_Entries = new List<RewardEntry>();
}
public RewardCategory( string name )
{
m_NameString = name;
m_Entries = new ArrayList();
m_Entries = new List<RewardEntry>();
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Gumps;
using Server.Network;
@ -90,11 +91,11 @@ namespace Server.Engines.VeteranRewards
{
AddPage( 2 + index );
ArrayList entries = category.Entries;
List<RewardEntry> entries = category.Entries;
for ( int i = 0; i < entries.Count; ++i )
{
RewardEntry entry = (RewardEntry)entries[i];
RewardEntry entry = entries[i];
if ( !RewardSystem.HasAccess( m_From, entry ) )
break;
@ -146,7 +147,7 @@ namespace Server.Engines.VeteranRewards
if ( index >= 0 && index < category.Entries.Count )
{
RewardEntry entry = (RewardEntry)category.Entries[index];
RewardEntry entry = category.Entries[index];
if ( !RewardSystem.HasAccess( m_From, entry ) )
return;