ugh @ baseescortable formatting

This commit is contained in:
mark 2009-09-06 03:45:12 +00:00
parent 06e5c8b732
commit 1320f14adf
13 changed files with 723 additions and 612 deletions

View file

@ -0,0 +1,97 @@
using System;
using Server;
using Server.Mobiles;
using Server.Spells;
using System.Collections;
using System.Collections.Generic;
namespace Server.Items
{
public class AcidSlime : Item
{
private TimeSpan m_Duration;
private int m_MinDamage;
private int m_MaxDamage;
private DateTime m_Created;
private bool m_Drying;
private Timer m_Timer;
[Constructable]
public AcidSlime() : this( TimeSpan.FromSeconds( 10.0 ), 5, 10 )
{
}
public override string DefaultName { get { return "slime"; } }
[Constructable]
public AcidSlime( TimeSpan duration, int minDamage, int maxDamage )
: base( 0x122A )
{
Hue = 0x3F;
Movable = false;
m_MinDamage = minDamage;
m_MaxDamage = maxDamage;
m_Created = DateTime.Now;
m_Duration = duration;
m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), new TimerCallback( OnTick ) );
}
public override void OnAfterDelete()
{
if( m_Timer != null )
m_Timer.Stop();
}
private void OnTick()
{
DateTime now = DateTime.Now;
TimeSpan age = now - m_Created;
if( age > m_Duration )
Delete();
else
{
if( !m_Drying && age > (m_Duration - age) )
{
m_Drying = true;
ItemID = 0x122B;
}
foreach( Mobile m in GetMobilesInRange( 0 ) )
{
BaseCreature bc = m as BaseCreature;
if( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
{
Damage ( m );
}
}
}
}
public override bool OnMoveOver( Mobile m )
{
Damage( m );
return true;
}
public void Damage ( Mobile m )
{
int damage = Utility.RandomMinMax( m_MinDamage, m_MaxDamage );
if ( Core.AOS )
AOS.Damage( m, damage, 0, 0, 0, 100, 0 );
else
m.Damage( damage );
}
public AcidSlime( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
}
public override void Deserialize( GenericReader reader )
{
}
}
}

View file

@ -1,4 +1,5 @@
using System;
using System.Globalization;
using Server;
using Server.Items;
using Server.Mobiles;
@ -68,7 +69,14 @@ namespace Server.Items
{
base.GetProperties( list );
list.Add( 1060738, Core.ML ? m_Worth.ToString( "N0" ) : m_Worth.ToString() ); // value: ~1_val~
string worth;
if ( Core.ML )
worth = m_Worth.ToString( "N0", CultureInfo.GetCultureInfo( "en-US" ) );
else
worth = m_Worth.ToString();
list.Add( 1060738, worth ); // value: ~1_val~
}
public override void OnSingleClick( Mobile from )

View file

@ -12,70 +12,10 @@ namespace Server.Items
private TimeSpan m_Duration;
private int m_MinDamage;
private int m_MaxDamage;
private DateTime m_Created;
private bool m_Drying;
private Timer m_Timer;
[CommandProperty( AccessLevel.GameMaster )]
public bool Drying
{
get
{
return m_Drying;
}
set
{
m_Drying = value;
if( m_Drying )
ItemID = 0x122A;
else
ItemID = 0x122B;
}
}
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan Duration{ get{ return m_Duration; } set{ m_Duration = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public int MinDamage
{
get
{
return m_MinDamage;
}
set
{
if ( value < 1 )
value = 1;
m_MinDamage = value;
}
}
[CommandProperty( AccessLevel.GameMaster )]
public int MaxDamage
{
get
{
return m_MaxDamage;
}
set
{
if ( value < 1 )
value = 1;
if ( value < MinDamage )
value = MinDamage;
m_MaxDamage = value;
}
}
[Constructable]
public PoolOfAcid() : this( TimeSpan.FromSeconds( 10.0 ), 2, 5 )
{
@ -113,37 +53,31 @@ namespace Server.Items
Delete();
else
{
if( !Drying && age > (m_Duration - age) )
Drying = true;
List<Mobile> toDamage = new List<Mobile>();
if( !m_Drying && age > (m_Duration - age) )
{
m_Drying = true;
ItemID = 0x122B;
}
foreach( Mobile m in GetMobilesInRange( 0 ) )
{
BaseCreature bc = m as BaseCreature;
if( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
{
toDamage.Add( m );
Damage ( m );
}
}
for( int i = 0; i < toDamage.Count; i++ )
Damage( toDamage[i] );
}
}
public override bool OnMoveOver( Mobile m )
{
Damage( m );
return true;
}
public void Damage( Mobile m )
public void Damage ( Mobile m )
{
m.Damage( Utility.RandomMinMax( MinDamage, MaxDamage ) );
m.Damage( Utility.RandomMinMax( m_MinDamage, m_MaxDamage ) );
}
public PoolOfAcid( Serial serial ) : base( serial )

View file

@ -128,6 +128,7 @@ namespace Server.Items
}
Explode( from, true, loc, map );
m_Timer = null;
}
else
{

View file

@ -3362,7 +3362,7 @@ namespace Server.Items
Type resourceType = typeRes;
if ( resourceType == null )
resourceType = craftItem.Ressources.GetAt( 0 ).ItemType;
resourceType = craftItem.Resources.GetAt( 0 ).ItemType;
if ( Core.AOS )
{