#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.

This commit is contained in:
WarrentyExpired 2026-08-06 11:06:05 -04:00
parent b51c58f514
commit 3045c83799
3512 changed files with 627673 additions and 0 deletions

View file

@ -0,0 +1,34 @@
using System;
using Server;
namespace Server.Items
{
public class AgilityPotion : BaseAgilityPotion
{
public override int DexOffset{ get{ return 10; } }
public override TimeSpan Duration{ get{ return TimeSpan.FromMinutes( 2.0 ); } }
[Constructable]
public AgilityPotion() : base( PotionEffect.Agility )
{
}
public AgilityPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,58 @@
using System;
using Server;
namespace Server.Items
{
public abstract class BaseAgilityPotion : BasePotion
{
public abstract int DexOffset{ get; }
public abstract TimeSpan Duration{ get; }
public BaseAgilityPotion( PotionEffect effect ) : base( 0xF08, effect )
{
}
public BaseAgilityPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public bool DoAgility( Mobile from )
{
// TODO: Verify scaled; is it offset, duration, or both?
if ( Spells.SpellHelper.AddStatOffset( from, StatType.Dex, Scale( from, DexOffset ), Duration ) )
{
from.FixedEffect( 0x375A, 10, 15 );
from.PlaySound( 0x1E7 );
return true;
}
from.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
return false;
}
public override void Drink( Mobile from )
{
if ( DoAgility( from ) )
{
BasePotion.PlayDrinkEffect( from );
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
this.Consume();
}
}
}
}

View file

@ -0,0 +1,34 @@
using System;
using Server;
namespace Server.Items
{
public class GreaterAgilityPotion : BaseAgilityPotion
{
public override int DexOffset{ get{ return 20; } }
public override TimeSpan Duration{ get{ return TimeSpan.FromMinutes( 2.0 ); } }
[Constructable]
public GreaterAgilityPotion() : base( PotionEffect.AgilityGreater )
{
}
public GreaterAgilityPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,275 @@
using System;
using Server;
using Server.Engines.Craft;
using System.Collections.Generic;
namespace Server.Items
{
public enum PotionEffect
{
Nightsight,
CureLesser,
Cure,
CureGreater,
Agility,
AgilityGreater,
Strength,
StrengthGreater,
PoisonLesser,
Poison,
PoisonGreater,
PoisonDeadly,
Refresh,
RefreshTotal,
HealLesser,
Heal,
HealGreater,
ExplosionLesser,
Explosion,
ExplosionGreater,
Conflagration,
ConflagrationGreater,
MaskOfDeath, // Mask of Death is not available in OSI but does exist in cliloc files
MaskOfDeathGreater, // included in enumeration for compatability if later enabled by OSI
ConfusionBlast,
ConfusionBlastGreater,
Invisibility,
Parasitic,
Darkglow,
}
public abstract class BasePotion : Item, ICraftable, ICommodity
{
private PotionEffect m_PotionEffect;
public PotionEffect PotionEffect
{
get
{
return m_PotionEffect;
}
set
{
m_PotionEffect = value;
InvalidateProperties();
}
}
int ICommodity.DescriptionNumber { get { return LabelNumber; } }
bool ICommodity.IsDeedable { get { return (Core.ML); } }
public override int LabelNumber{ get{ return 1041314 + (int)m_PotionEffect; } }
public BasePotion( int itemID, PotionEffect effect ) : base( itemID )
{
m_PotionEffect = effect;
Stackable = Core.ML;
Weight = 1.0;
}
public BasePotion( Serial serial ) : base( serial )
{
}
public virtual bool RequireFreeHand{ get{ return true; } }
public static bool HasFreeHand( Mobile m )
{
Item handOne = m.FindItemOnLayer( Layer.OneHanded );
Item handTwo = m.FindItemOnLayer( Layer.TwoHanded );
if ( handTwo is BaseWeapon )
handOne = handTwo;
if ( handTwo is BaseRanged )
{
BaseRanged ranged = (BaseRanged) handTwo;
if ( ranged.Balanced )
return true;
}
return ( handOne == null || handTwo == null );
}
public override void OnDoubleClick( Mobile from )
{
if ( !Movable )
return;
if ( from.InRange( this.GetWorldLocation(), 1 ) )
{
if (!RequireFreeHand || HasFreeHand(from))
{
if (this is BaseExplosionPotion && Amount > 1)
{
BasePotion pot = (BasePotion)Activator.CreateInstance(this.GetType());
if (pot != null)
{
Amount--;
if (from.Backpack != null && !from.Backpack.Deleted)
{
from.Backpack.DropItem(pot);
}
else
{
pot.MoveToWorld(from.Location, from.Map);
}
pot.Drink( from );
}
}
else
{
this.Drink( from );
}
}
else
{
from.SendLocalizedMessage(502172); // You must have a free hand to drink a potion.
}
}
else
{
from.SendLocalizedMessage( 502138 ); // That is too far away for you to use
}
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 1 ); // version
writer.Write( (int) m_PotionEffect );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 1:
case 0:
{
m_PotionEffect = (PotionEffect)reader.ReadInt();
break;
}
}
if( version == 0 )
Stackable = Core.ML;
}
public abstract void Drink( Mobile from );
public static void PlayDrinkEffect( Mobile m )
{
m.RevealingAction();
m.PlaySound( 0x2D6 );
#region Dueling
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( m ) )
m.AddToBackpack( new Bottle() );
#endregion
if ( m.Body.IsHuman && !m.Mounted )
m.Animate( 34, 5, 1, true, false, 0 );
}
public static int EnhancePotions( Mobile m )
{
int EP = AosAttributes.GetValue( m, AosAttribute.EnhancePotions );
int skillBonus = m.Skills.Alchemy.Fixed / 330 * 10;
if ( Core.ML && EP > 50 && m.AccessLevel <= AccessLevel.Player )
EP = 50;
return ( EP + skillBonus );
}
public static TimeSpan Scale( Mobile m, TimeSpan v )
{
if ( !Core.AOS )
return v;
double scalar = 1.0 + ( 0.01 * EnhancePotions( m ) );
return TimeSpan.FromSeconds( v.TotalSeconds * scalar );
}
public static double Scale( Mobile m, double v )
{
if ( !Core.AOS )
return v;
double scalar = 1.0 + ( 0.01 * EnhancePotions( m ) );
return v * scalar;
}
public static int Scale( Mobile m, int v )
{
if ( !Core.AOS )
return v;
return AOS.Scale( v, 100 + EnhancePotions( m ) );
}
public override bool StackWith( Mobile from, Item dropped, bool playSound )
{
if( dropped is BasePotion && ((BasePotion)dropped).m_PotionEffect == m_PotionEffect )
return base.StackWith( from, dropped, playSound );
return false;
}
#region ICraftable Members
public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
{
if ( craftSystem is DefAlchemy )
{
Container pack = from.Backpack;
if ( pack != null )
{
if ( (int) PotionEffect >= (int) PotionEffect.Invisibility )
return 1;
List<PotionKeg> kegs = pack.FindItemsByType<PotionKeg>();
for ( int i = 0; i < kegs.Count; ++i )
{
PotionKeg keg = kegs[i];
if ( keg == null )
continue;
if ( keg.Held <= 0 || keg.Held >= 100 )
continue;
if ( keg.Type != PotionEffect )
continue;
++keg.Held;
Consume();
from.AddToBackpack( new Bottle() );
return -1; // signal placed in keg
}
}
}
return 1;
}
#endregion
}
}

View file

@ -0,0 +1,347 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Network;
using Server.Targeting;
using Server.Spells;
namespace Server.Items
{
public abstract class BaseConflagrationPotion : BasePotion
{
public abstract int MinDamage{ get; }
public abstract int MaxDamage{ get; }
public override bool RequireFreeHand{ get{ return false; } }
public BaseConflagrationPotion( PotionEffect effect ) : base( 0xF06, effect )
{
Hue = 0x489;
}
public BaseConflagrationPotion( Serial serial ) : base( serial )
{
}
public override void Drink( Mobile from )
{
if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
{
from.SendLocalizedMessage( 1062725 ); // You can not use that potion while paralyzed.
return;
}
int delay = GetDelay( from );
if ( delay > 0 )
{
from.SendLocalizedMessage( 1072529, String.Format( "{0}\t{1}", delay, delay > 1 ? "seconds." : "second." ) ); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
return;
}
ThrowTarget targ = from.Target as ThrowTarget;
if ( targ != null && targ.Potion == this )
return;
from.RevealingAction();
if ( !m_Users.Contains( from ) )
m_Users.Add( from );
from.Target = new ThrowTarget( this );
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
private List<Mobile> m_Users = new List<Mobile>();
public void Explode_Callback( object state )
{
object[] states = (object[]) state;
Explode( (Mobile) states[ 0 ], (Point3D) states[ 1 ], (Map) states[ 2 ] );
}
public virtual void Explode( Mobile from, Point3D loc, Map map )
{
if ( Deleted || map == null )
return;
Consume();
// Check if any other players are using this potion
for ( int i = 0; i < m_Users.Count; i ++ )
{
ThrowTarget targ = m_Users[ i ].Target as ThrowTarget;
if ( targ != null && targ.Potion == this )
Target.Cancel( from );
}
// Effects
Effects.PlaySound( loc, map, 0x20C );
for ( int i = -2; i <= 2; i ++ )
{
for ( int j = -2; j <= 2; j ++ )
{
Point3D p = new Point3D( loc.X + i, loc.Y + j, loc.Z );
if ( map.CanFit( p, 12, true, false ) && from.InLOS( p ) )
new InternalItem( from, p, map, MinDamage, MaxDamage );
}
}
}
#region Delay
private static Hashtable m_Delay = new Hashtable();
public static void AddDelay( Mobile m )
{
Timer timer = m_Delay[ m ] as Timer;
if ( timer != null )
timer.Stop();
m_Delay[ m ] = Timer.DelayCall( TimeSpan.FromSeconds( 30 ), new TimerStateCallback( EndDelay_Callback ), m );
}
public static int GetDelay( Mobile m )
{
Timer timer = m_Delay[ m ] as Timer;
if ( timer != null && timer.Next > DateTime.UtcNow )
return (int) (timer.Next - DateTime.UtcNow).TotalSeconds;
return 0;
}
private static void EndDelay_Callback( object obj )
{
if ( obj is Mobile )
EndDelay( (Mobile) obj );
}
public static void EndDelay( Mobile m )
{
Timer timer = m_Delay[ m ] as Timer;
if ( timer != null )
{
timer.Stop();
m_Delay.Remove( m );
}
}
#endregion
private class ThrowTarget : Target
{
private BaseConflagrationPotion m_Potion;
public BaseConflagrationPotion Potion
{
get{ return m_Potion; }
}
public ThrowTarget( BaseConflagrationPotion potion ) : base( 12, true, TargetFlags.None )
{
m_Potion = potion;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
return;
IPoint3D p = targeted as IPoint3D;
if ( p == null || from.Map == null )
return;
// Add delay
BaseConflagrationPotion.AddDelay( from );
SpellHelper.GetSurfaceTop( ref p );
from.RevealingAction();
IEntity to;
if ( p is Mobile )
to = (Mobile)p;
else
to = new Entity( Serial.Zero, new Point3D( p ), from.Map );
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, m_Potion.Hue, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), new TimerStateCallback( m_Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
}
}
public class InternalItem : Item
{
private Mobile m_From;
private int m_MinDamage;
private int m_MaxDamage;
private DateTime m_End;
private Timer m_Timer;
public Mobile From{ get{ return m_From; } }
public override bool BlocksFit{ get{ return true; } }
public InternalItem( Mobile from, Point3D loc, Map map, int min, int max ) : base( 0x398C )
{
Movable = false;
Light = LightType.Circle300;
MoveToWorld( loc, map );
m_From = from;
m_End = DateTime.UtcNow + TimeSpan.FromSeconds( 10 );
SetDamage( min, max );
m_Timer = new InternalTimer( this, m_End );
m_Timer.Start();
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
if ( m_Timer != null )
m_Timer.Stop();
}
public InternalItem( Serial serial ) : base( serial )
{
}
public int GetDamage(){ return Utility.RandomMinMax( m_MinDamage, m_MaxDamage ); }
private void SetDamage( int min, int max )
{
/* new way to apply alchemy bonus according to Stratics' calculator.
this gives a mean to values 25, 50, 75 and 100. Stratics' calculator is outdated.
Those goals will give 2 to alchemy bonus. It's not really OSI-like but it's an approximation. */
m_MinDamage = min;
m_MaxDamage = max;
if( m_From == null )
return;
int alchemySkill = m_From.Skills.Alchemy.Fixed;
int alchemyBonus = alchemySkill / 125 + alchemySkill / 250 ;
m_MinDamage = Scale( m_From, m_MinDamage + alchemyBonus );
m_MaxDamage = Scale( m_From, m_MaxDamage + alchemyBonus );
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (Mobile) m_From );
writer.Write( (DateTime) m_End );
writer.Write( (int) m_MinDamage );
writer.Write( (int) m_MaxDamage );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_From = reader.ReadMobile();
m_End = reader.ReadDateTime();
m_MinDamage = reader.ReadInt();
m_MaxDamage = reader.ReadInt();
m_Timer = new InternalTimer( this, m_End );
m_Timer.Start();
}
public override bool OnMoveOver( Mobile m )
{
if ( Visible && m_From != null && (!Core.AOS || m != m_From) && SpellHelper.ValidIndirectTarget( m_From, m ) && m_From.CanBeHarmful( m, false ) )
{
m_From.DoHarmful( m );
AOS.Damage( m, m_From, GetDamage(), 0, 100, 0, 0, 0 );
m.PlaySound( 0x208 );
}
return true;
}
private class InternalTimer : Timer
{
private InternalItem m_Item;
private DateTime m_End;
public InternalTimer( InternalItem item, DateTime end ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 1.0 ) )
{
m_Item = item;
m_End = end;
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()
{
if ( m_Item.Deleted )
return;
if ( DateTime.UtcNow > m_End )
{
m_Item.Delete();
Stop();
return;
}
Mobile from = m_Item.From;
if ( m_Item.Map == null || from == null )
return;
List<Mobile> mobiles = new List<Mobile>();
foreach( Mobile mobile in m_Item.GetMobilesInRange( 0 ) )
mobiles.Add( mobile );
for( int i = 0; i < mobiles.Count; i++ )
{
Mobile m = mobiles[i];
if ( (m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && (!Core.AOS || m != from) && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) )
{
if ( from != null )
from.DoHarmful( m );
AOS.Damage( m, from, m_Item.GetDamage(), 0, 100, 0, 0, 0 );
m.PlaySound( 0x208 );
}
}
}
}
}
}
}

View file

@ -0,0 +1,36 @@
using System;
using Server;
namespace Server.Items
{
public class ConflagrationPotion : BaseConflagrationPotion
{
public override int MinDamage{ get{ return 2; } }
public override int MaxDamage{ get{ return 4; } }
public override int LabelNumber{ get{ return 1072095; } } // a Conflagration potion
[Constructable]
public ConflagrationPotion() : base( PotionEffect.Conflagration )
{
}
public ConflagrationPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,36 @@
using System;
using Server;
namespace Server.Items
{
public class GreaterConflagrationPotion : BaseConflagrationPotion
{
public override int MinDamage{ get{ return 4; } }
public override int MaxDamage{ get{ return 8; } }
public override int LabelNumber{ get{ return 1072098; } } // a Greater Conflagration potion
[Constructable]
public GreaterConflagrationPotion() : base( PotionEffect.ConflagrationGreater )
{
}
public GreaterConflagrationPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,216 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Network;
using Server.Targeting;
using Server.Spells;
using Server.Mobiles;
using Server.Misc;
namespace Server.Items
{
public abstract class BaseConfusionBlastPotion : BasePotion
{
public abstract int Radius{ get; }
public override bool RequireFreeHand{ get{ return false; } }
public BaseConfusionBlastPotion( PotionEffect effect ) : base( 0xF06, effect )
{
Hue = 0x48D;
}
public BaseConfusionBlastPotion( Serial serial ) : base( serial )
{
}
public override void Drink( Mobile from )
{
if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
{
from.SendLocalizedMessage( 1062725 ); // You can not use that potion while paralyzed.
return;
}
int delay = GetDelay( from );
if ( delay > 0 )
{
from.SendLocalizedMessage( 1072529, String.Format( "{0}\t{1}", delay, delay > 1 ? "seconds." : "second." ) ); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
return;
}
ThrowTarget targ = from.Target as ThrowTarget;
if ( targ != null && targ.Potion == this )
return;
from.RevealingAction();
if ( !m_Users.Contains( from ) )
m_Users.Add( from );
from.Target = new ThrowTarget( this );
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
private List<Mobile> m_Users = new List<Mobile>();
public void Explode_Callback( object state )
{
object[] states = (object[]) state;
Explode( (Mobile) states[ 0 ], (Point3D) states[ 1 ], (Map) states[ 2 ] );
}
public virtual void Explode( Mobile from, Point3D loc, Map map )
{
if ( Deleted || map == null )
return;
Consume();
// Check if any other players are using this potion
for ( int i = 0; i < m_Users.Count; i ++ )
{
ThrowTarget targ = m_Users[ i ].Target as ThrowTarget;
if ( targ != null && targ.Potion == this )
Target.Cancel( from );
}
// Effects
Effects.PlaySound( loc, map, 0x207 );
Geometry.Circle2D( loc, map, Radius, new DoEffect_Callback( BlastEffect ), 270, 90 );
Timer.DelayCall( TimeSpan.FromSeconds( 0.3 ), new TimerStateCallback( CircleEffect2 ), new object[] { loc, map } );
foreach ( Mobile mobile in map.GetMobilesInRange( loc, Radius ) )
{
if ( mobile is BaseCreature )
{
BaseCreature mon = (BaseCreature) mobile;
if ( mon.Controlled || mon.Summoned )
continue;
mon.Pacify( from, DateTime.UtcNow + TimeSpan.FromSeconds( 5.0 ) ); // TODO check
}
}
}
#region Effects
public virtual void BlastEffect( Point3D p, Map map )
{
if ( map.CanFit( p, 12, true, false ) )
Effects.SendLocationEffect( p, map, 0x376A, 4, 9 );
}
public void CircleEffect2( object state )
{
object[] states = (object[]) state;
Geometry.Circle2D( (Point3D)states[0], (Map)states[1], Radius, new DoEffect_Callback( BlastEffect ), 90, 270 );
}
#endregion
#region Delay
private static Hashtable m_Delay = new Hashtable();
public static void AddDelay( Mobile m )
{
Timer timer = m_Delay[ m ] as Timer;
if ( timer != null )
timer.Stop();
m_Delay[ m ] = Timer.DelayCall( TimeSpan.FromSeconds( 60 ), new TimerStateCallback( EndDelay_Callback ), m );
}
public static int GetDelay( Mobile m )
{
Timer timer = m_Delay[ m ] as Timer;
if ( timer != null && timer.Next > DateTime.UtcNow )
return (int) (timer.Next - DateTime.UtcNow).TotalSeconds;
return 0;
}
private static void EndDelay_Callback( object obj )
{
if ( obj is Mobile )
EndDelay( (Mobile) obj );
}
public static void EndDelay( Mobile m )
{
Timer timer = m_Delay[ m ] as Timer;
if ( timer != null )
{
timer.Stop();
m_Delay.Remove( m );
}
}
#endregion
private class ThrowTarget : Target
{
private BaseConfusionBlastPotion m_Potion;
public BaseConfusionBlastPotion Potion
{
get{ return m_Potion; }
}
public ThrowTarget( BaseConfusionBlastPotion potion ) : base( 12, true, TargetFlags.None )
{
m_Potion = potion;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
return;
IPoint3D p = targeted as IPoint3D;
if ( p == null || from.Map == null )
return;
// Add delay
BaseConfusionBlastPotion.AddDelay( from );
SpellHelper.GetSurfaceTop( ref p );
from.RevealingAction();
IEntity to;
if ( p is Mobile )
to = (Mobile)p;
else
to = new Entity( Serial.Zero, new Point3D( p ), from.Map );
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, m_Potion.Hue, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
}
}
}
}

View file

@ -0,0 +1,35 @@
using System;
using Server;
namespace Server.Items
{
public class ConfusionBlastPotion : BaseConfusionBlastPotion
{
public override int Radius{ get{ return 5; } }
public override int LabelNumber{ get{ return 1072105; } } // a Confusion Blast potion
[Constructable]
public ConfusionBlastPotion() : base( PotionEffect.ConfusionBlast )
{
}
public ConfusionBlastPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,35 @@
using System;
using Server;
namespace Server.Items
{
public class GreaterConfusionBlastPotion : BaseConfusionBlastPotion
{
public override int Radius{ get{ return 7; } }
public override int LabelNumber{ get{ return 1072108; } } // a Greater Confusion Blast potion
[Constructable]
public GreaterConfusionBlastPotion() : base( PotionEffect.ConfusionBlastGreater )
{
}
public GreaterConfusionBlastPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,109 @@
using System;
using Server;
using Server.Spells;
namespace Server.Items
{
public class CureLevelInfo
{
private Poison m_Poison;
private double m_Chance;
public Poison Poison
{
get{ return m_Poison; }
}
public double Chance
{
get{ return m_Chance; }
}
public CureLevelInfo( Poison poison, double chance )
{
m_Poison = poison;
m_Chance = chance;
}
}
public abstract class BaseCurePotion : BasePotion
{
public abstract CureLevelInfo[] LevelInfo{ get; }
public BaseCurePotion( PotionEffect effect ) : base( 0xF07, effect )
{
}
public BaseCurePotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public void DoCure( Mobile from )
{
bool cure = false;
CureLevelInfo[] info = LevelInfo;
for ( int i = 0; i < info.Length; ++i )
{
CureLevelInfo li = info[i];
if ( li.Poison == from.Poison && Scale( from, li.Chance ) > Utility.RandomDouble() )
{
cure = true;
break;
}
}
if ( cure && from.CurePoison( from ) )
{
from.SendLocalizedMessage( 500231 ); // You feel cured of poison!
from.FixedEffect( 0x373A, 10, 15 );
from.PlaySound( 0x1E0 );
}
else if ( !cure )
{
from.SendLocalizedMessage( 500232 ); // That potion was not strong enough to cure your ailment!
}
}
public override void Drink( Mobile from )
{
if ( TransformationSpellHelper.UnderTransformation( from, typeof( Spells.Necromancy.VampiricEmbraceSpell ) ) )
{
from.SendLocalizedMessage( 1061652 ); // The garlic in the potion would surely kill you.
}
else if ( from.Poisoned )
{
DoCure( from );
BasePotion.PlayDrinkEffect( from );
from.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist );
from.PlaySound( 0x1E0 );
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
this.Consume();
}
else
{
from.SendLocalizedMessage( 1042000 ); // You are not poisoned.
}
}
}
}

View file

@ -0,0 +1,50 @@
using System;
using Server;
namespace Server.Items
{
public class CurePotion : BaseCurePotion
{
private static CureLevelInfo[] m_OldLevelInfo = new CureLevelInfo[]
{
new CureLevelInfo( Poison.Lesser, 1.00 ), // 100% chance to cure lesser poison
new CureLevelInfo( Poison.Regular, 0.75 ), // 75% chance to cure regular poison
new CureLevelInfo( Poison.Greater, 0.50 ), // 50% chance to cure greater poison
new CureLevelInfo( Poison.Deadly, 0.15 ) // 15% chance to cure deadly poison
};
private static CureLevelInfo[] m_AosLevelInfo = new CureLevelInfo[]
{
new CureLevelInfo( Poison.Lesser, 1.00 ),
new CureLevelInfo( Poison.Regular, 0.95 ),
new CureLevelInfo( Poison.Greater, 0.75 ),
new CureLevelInfo( Poison.Deadly, 0.50 ),
new CureLevelInfo( Poison.Lethal, 0.25 )
};
public override CureLevelInfo[] LevelInfo{ get{ return Core.AOS ? m_AosLevelInfo : m_OldLevelInfo; } }
[Constructable]
public CurePotion() : base( PotionEffect.Cure )
{
}
public CurePotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,51 @@
using System;
using Server;
namespace Server.Items
{
public class GreaterCurePotion : BaseCurePotion
{
private static CureLevelInfo[] m_OldLevelInfo = new CureLevelInfo[]
{
new CureLevelInfo( Poison.Lesser, 1.00 ), // 100% chance to cure lesser poison
new CureLevelInfo( Poison.Regular, 1.00 ), // 100% chance to cure regular poison
new CureLevelInfo( Poison.Greater, 1.00 ), // 100% chance to cure greater poison
new CureLevelInfo( Poison.Deadly, 0.75 ), // 75% chance to cure deadly poison
new CureLevelInfo( Poison.Lethal, 0.25 ) // 25% chance to cure lethal poison
};
private static CureLevelInfo[] m_AosLevelInfo = new CureLevelInfo[]
{
new CureLevelInfo( Poison.Lesser, 1.00 ),
new CureLevelInfo( Poison.Regular, 1.00 ),
new CureLevelInfo( Poison.Greater, 1.00 ),
new CureLevelInfo( Poison.Deadly, 0.95 ),
new CureLevelInfo( Poison.Lethal, 0.75 )
};
public override CureLevelInfo[] LevelInfo{ get{ return Core.AOS ? m_AosLevelInfo : m_OldLevelInfo; } }
[Constructable]
public GreaterCurePotion() : base( PotionEffect.CureGreater )
{
}
public GreaterCurePotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,47 @@
using System;
using Server;
namespace Server.Items
{
public class LesserCurePotion : BaseCurePotion
{
private static CureLevelInfo[] m_OldLevelInfo = new CureLevelInfo[]
{
new CureLevelInfo( Poison.Lesser, 0.75 ), // 75% chance to cure lesser poison
new CureLevelInfo( Poison.Regular, 0.50 ), // 50% chance to cure regular poison
new CureLevelInfo( Poison.Greater, 0.15 ) // 15% chance to cure greater poison
};
private static CureLevelInfo[] m_AosLevelInfo = new CureLevelInfo[]
{
new CureLevelInfo( Poison.Lesser, 0.75 ),
new CureLevelInfo( Poison.Regular, 0.50 ),
new CureLevelInfo( Poison.Greater, 0.25 )
};
public override CureLevelInfo[] LevelInfo{ get{ return Core.AOS ? m_AosLevelInfo : m_OldLevelInfo; } }
[Constructable]
public LesserCurePotion() : base( PotionEffect.CureLesser )
{
}
public LesserCurePotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,39 @@
using System;
using Server;
namespace Server.Items
{
public class DarkglowPotion : BasePoisonPotion
{
public override Poison Poison{ get{ return Poison.Greater; } } /* MUST be restored when prerequisites are done */
public override double MinPoisoningSkill{ get{ return 95.0; } }
public override double MaxPoisoningSkill{ get{ return 100.0; } }
public override int LabelNumber{ get{ return 1072849; } } // Darkglow Poison
[Constructable]
public DarkglowPotion() : base( PotionEffect.Darkglow )
{
Hue = 0x96;
}
public DarkglowPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,309 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Network;
using Server.Targeting;
using Server.Spells;
namespace Server.Items
{
public abstract class BaseExplosionPotion : BasePotion
{
public abstract int MinDamage { get; }
public abstract int MaxDamage { get; }
public override bool RequireFreeHand{ get{ return false; } }
private static bool LeveledExplosion = false; // Should explosion potions explode other nearby potions?
private static bool InstantExplosion = false; // Should explosion potions explode on impact?
private static bool RelativeLocation = false; // Is the explosion target location relative for mobiles?
private const int ExplosionRange = 2; // How long is the blast radius?
public BaseExplosionPotion( PotionEffect effect ) : base( 0xF0D, effect )
{
}
public BaseExplosionPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public virtual object FindParent( Mobile from )
{
Mobile m = this.HeldBy;
if ( m != null && m.Holding == this )
return m;
object obj = this.RootParent;
if ( obj != null )
return obj;
if ( Map == Map.Internal )
return from;
return this;
}
private Timer m_Timer;
public List<Mobile> Users { get { return m_Users; } }
private List<Mobile> m_Users;
public override void Drink( Mobile from )
{
if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
{
from.SendLocalizedMessage( 1062725 ); // You can not use a purple potion while paralyzed.
return;
}
ThrowTarget targ = from.Target as ThrowTarget;
this.Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode.
if ( targ != null && targ.Potion == this )
return;
from.RevealingAction();
if ( m_Users == null )
m_Users = new List<Mobile>();
if ( !m_Users.Contains( from ) )
m_Users.Add( from );
from.Target = new ThrowTarget( this );
if ( m_Timer == null )
{
from.SendLocalizedMessage( 500236 ); // You should throw it now!
if( Core.ML )
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.25 ), 5, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } ); // 3.6 seconds explosion delay
else
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.75 ), TimeSpan.FromSeconds( 1.0 ), 4, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } ); // 2.6 seconds explosion delay
}
}
private void Detonate_OnTick( object state )
{
if ( Deleted )
return;
object[] states = (object[])state;
Mobile from = (Mobile)states[0];
int timer = (int)states[1];
object parent = FindParent( from );
if ( timer == 0 )
{
Point3D loc;
Map map;
if ( parent is Item )
{
Item item = (Item)parent;
loc = item.GetWorldLocation();
map = item.Map;
}
else if ( parent is Mobile )
{
Mobile m = (Mobile)parent;
loc = m.Location;
map = m.Map;
}
else
{
return;
}
Explode( from, true, loc, map );
m_Timer = null;
}
else
{
if ( parent is Item )
((Item)parent).PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
else if ( parent is Mobile )
((Mobile)parent).PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
states[1] = timer - 1;
}
}
private void Reposition_OnTick( object state )
{
if ( Deleted )
return;
object[] states = (object[])state;
Mobile from = (Mobile)states[0];
IPoint3D p = (IPoint3D)states[1];
Map map = (Map)states[2];
Point3D loc = new Point3D( p );
if ( InstantExplosion )
Explode( from, true, loc, map );
else
MoveToWorld( loc, map );
}
private class ThrowTarget : Target
{
private BaseExplosionPotion m_Potion;
public BaseExplosionPotion Potion
{
get{ return m_Potion; }
}
public ThrowTarget( BaseExplosionPotion potion ) : base( 12, true, TargetFlags.None )
{
m_Potion = potion;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
return;
IPoint3D p = targeted as IPoint3D;
if ( p == null )
return;
Map map = from.Map;
if ( map == null )
return;
SpellHelper.GetSurfaceTop( ref p );
from.RevealingAction();
IEntity to;
to = new Entity( Serial.Zero, new Point3D( p ), map );
if( p is Mobile )
{
if( !RelativeLocation ) // explosion location = current mob location.
p = ((Mobile)p).Location;
else
to = (Mobile)p;
}
Effects.SendMovingEffect( from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0 );
if( m_Potion.Amount > 1 )
{
Mobile.LiftItemDupe( m_Potion, 1 );
}
m_Potion.Internalize();
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_Potion.Reposition_OnTick ), new object[]{ from, p, map } );
}
}
public void Explode( Mobile from, bool direct, Point3D loc, Map map )
{
if ( Deleted )
return;
Consume();
for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
{
Mobile m = m_Users[i];
ThrowTarget targ = m.Target as ThrowTarget;
if ( targ != null && targ.Potion == this )
Target.Cancel( m );
}
if ( map == null )
return;
Effects.PlaySound(loc, map, 0x307);
Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
int alchemyBonus = 0;
if ( direct )
alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
IPooledEnumerable eable = LeveledExplosion ? (IPooledEnumerable)map.GetObjectsInRange( loc, ExplosionRange ) : (IPooledEnumerable)map.GetMobilesInRange( loc, ExplosionRange );
ArrayList toExplode = new ArrayList();
int toDamage = 0;
foreach ( object o in eable )
{
if ( o is Mobile && (from == null || (SpellHelper.ValidIndirectTarget( from, (Mobile)o ) && from.CanBeHarmful( (Mobile)o, false ))))
{
toExplode.Add( o );
++toDamage;
}
else if ( o is BaseExplosionPotion && o != this )
{
toExplode.Add( o );
}
}
eable.Free();
int min = Scale( from, MinDamage );
int max = Scale( from, MaxDamage );
for ( int i = 0; i < toExplode.Count; ++i )
{
object o = toExplode[i];
if ( o is Mobile )
{
Mobile m = (Mobile)o;
if ( from != null )
from.DoHarmful( m );
int damage = Utility.RandomMinMax( min, max );
damage += alchemyBonus;
if ( !Core.AOS && damage > 40 )
damage = 40;
else if ( Core.AOS && toDamage > 2 )
damage /= toDamage - 1;
AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 );
}
else if ( o is BaseExplosionPotion )
{
BaseExplosionPotion pot = (BaseExplosionPotion)o;
pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
}
}
}
}
}

View file

@ -0,0 +1,34 @@
using System;
using Server;
namespace Server.Items
{
public class ExplosionPotion : BaseExplosionPotion
{
public override int MinDamage { get { return 10; } }
public override int MaxDamage { get { return 20; } }
[Constructable]
public ExplosionPotion() : base( PotionEffect.Explosion )
{
}
public ExplosionPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,34 @@
using System;
using Server;
namespace Server.Items
{
public class GreaterExplosionPotion : BaseExplosionPotion
{
public override int MinDamage { get { return Core.AOS ? 20 : 15; } }
public override int MaxDamage { get { return Core.AOS ? 40 : 30; } }
[Constructable]
public GreaterExplosionPotion() : base( PotionEffect.ExplosionGreater )
{
}
public GreaterExplosionPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,34 @@
using System;
using Server;
namespace Server.Items
{
public class LesserExplosionPotion : BaseExplosionPotion
{
public override int MinDamage { get { return 5; } }
public override int MaxDamage { get { return 10; } }
[Constructable]
public LesserExplosionPotion() : base( PotionEffect.ExplosionLesser )
{
}
public LesserExplosionPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,81 @@
using System;
using Server;
using Server.Network;
namespace Server.Items
{
public abstract class BaseHealPotion : BasePotion
{
public abstract int MinHeal { get; }
public abstract int MaxHeal { get; }
public abstract double Delay { get; }
public BaseHealPotion( PotionEffect effect ) : base( 0xF0C, effect )
{
}
public BaseHealPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public void DoHeal( Mobile from )
{
int min = Scale( from, MinHeal );
int max = Scale( from, MaxHeal );
from.Heal( Utility.RandomMinMax( min, max ) );
}
public override void Drink( Mobile from )
{
if ( from.Hits < from.HitsMax )
{
if ( from.Poisoned || MortalStrike.IsWounded( from ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x22, 1005000 ); // You can not heal yourself in your current state.
}
else
{
if ( from.BeginAction( typeof( BaseHealPotion ) ) )
{
DoHeal( from );
BasePotion.PlayDrinkEffect( from );
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
this.Consume();
Timer.DelayCall( TimeSpan.FromSeconds( Delay ), new TimerStateCallback( ReleaseHealLock ), from );
}
else
{
from.LocalOverheadMessage( MessageType.Regular, 0x22, 500235 ); // You must wait 10 seconds before using another healing potion.
}
}
}
else
{
from.SendLocalizedMessage( 1049547 ); // You decide against drinking this potion, as you are already at full health.
}
}
private static void ReleaseHealLock( object state )
{
((Mobile)state).EndAction( typeof( BaseHealPotion ) );
}
}
}

View file

@ -0,0 +1,35 @@
using System;
using Server;
namespace Server.Items
{
public class GreaterHealPotion : BaseHealPotion
{
public override int MinHeal { get { return (Core.AOS ? 20 : 9); } }
public override int MaxHeal { get { return (Core.AOS ? 25 : 30); } }
public override double Delay{ get{ return 10.0; } }
[Constructable]
public GreaterHealPotion() : base( PotionEffect.HealGreater )
{
}
public GreaterHealPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,35 @@
using System;
using Server;
namespace Server.Items
{
public class HealPotion : BaseHealPotion
{
public override int MinHeal { get { return (Core.AOS ? 13 : 6); } }
public override int MaxHeal { get { return (Core.AOS ? 16 : 20); } }
public override double Delay{ get{ return (Core.AOS ? 8.0 : 10.0); } }
[Constructable]
public HealPotion() : base( PotionEffect.Heal )
{
}
public HealPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,35 @@
using System;
using Server;
namespace Server.Items
{
public class LesserHealPotion : BaseHealPotion
{
public override int MinHeal { get { return (Core.AOS ? 6 : 3); } }
public override int MaxHeal { get { return (Core.AOS ? 8 : 10); } }
public override double Delay{ get{ return (Core.AOS ? 3.0 : 10.0); } }
[Constructable]
public LesserHealPotion() : base( PotionEffect.HealLesser )
{
}
public LesserHealPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,111 @@
using System;
using System.Collections;
using Server;
namespace Server.Items
{
public class InvisibilityPotion : BasePotion
{
public override int LabelNumber{ get{ return 1072941; } } // Potion of Invisibility
[Constructable]
public InvisibilityPotion() : base( 0xF0A, PotionEffect.Invisibility )
{
Hue = 0x48D;
}
public InvisibilityPotion( Serial serial ) : base( serial )
{
}
public override void Drink( Mobile from )
{
if ( from.Hidden )
{
from.SendLocalizedMessage( 1073185 ); // You are already unseen.
return;
}
if ( HasTimer( from ) )
{
from.SendLocalizedMessage( 1073186 ); // An invisibility potion is already taking effect on your person.
return;
}
Consume();
m_Table[ from ] = Timer.DelayCall( TimeSpan.FromSeconds( 2 ), new TimerStateCallback( Hide_Callback ), from );
PlayDrinkEffect( from );
}
private static void Hide_Callback( object obj )
{
if ( obj is Mobile )
Hide( (Mobile) obj );
}
public static void Hide( Mobile m )
{
Effects.SendLocationParticles( EffectItem.Create( new Point3D( m.X, m.Y, m.Z + 16 ), m.Map, EffectItem.DefaultDuration ), 0x376A, 10, 15, 5045 );
m.PlaySound( 0x3C4 );
m.Hidden = true;
BuffInfo.RemoveBuff( m, BuffIcon.HidingAndOrStealth );
BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.Invisibility, 1075825 ) ); //Invisibility/Invisible
RemoveTimer( m );
Timer.DelayCall( TimeSpan.FromSeconds( 30 ), new TimerStateCallback( EndHide_Callback ), m );
}
private static void EndHide_Callback( object obj )
{
if ( obj is Mobile )
EndHide( (Mobile) obj );
}
public static void EndHide( Mobile m )
{
m.RevealingAction();
RemoveTimer( m );
}
private static Hashtable m_Table = new Hashtable();
public static bool HasTimer( Mobile m )
{
return m_Table[ m ] != null;
}
public static void RemoveTimer( Mobile m )
{
Timer t = (Timer) m_Table[ m ];
if ( t != null )
{
t.Stop();
m_Table.Remove( m );
}
}
public static void Iterrupt( Mobile m )
{
m.SendLocalizedMessage( 1073187 ); // The invisibility effect is interrupted.
RemoveTimer( m );
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,52 @@
using System;
using Server;
namespace Server.Items
{
public class NightSightPotion : BasePotion
{
[Constructable]
public NightSightPotion() : base( 0xF06, PotionEffect.Nightsight )
{
}
public NightSightPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Drink( Mobile from )
{
if ( from.BeginAction( typeof( LightCycle ) ) )
{
new LightCycle.NightSightTimer( from ).Start();
from.LightLevel = LightCycle.DungeonLevel / 2;
from.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist );
from.PlaySound( 0x1E3 );
BasePotion.PlayDrinkEffect( from );
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
this.Consume();
}
else
{
from.SendMessage( "You already have nightsight." );
}
}
}
}

View file

@ -0,0 +1,39 @@
using System;
using Server;
namespace Server.Items
{
public class ParasiticPotion : BasePoisonPotion
{
public override Poison Poison{ get{ return Poison.Greater; } } /* public override Poison Poison{ get{ return Poison.Darkglow; } } MUST be restored when prerequisites are done */
public override double MinPoisoningSkill{ get{ return 95.0; } }
public override double MaxPoisoningSkill{ get{ return 100.0; } }
public override int LabelNumber{ get{ return 1072848; } } // Parasitic Poison
[Constructable]
public ParasiticPotion() : base( PotionEffect.Parasitic )
{
Hue = 0x17C;
}
public ParasiticPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,50 @@
using System;
using Server;
namespace Server.Items
{
public abstract class BasePoisonPotion : BasePotion
{
public abstract Poison Poison{ get; }
public abstract double MinPoisoningSkill{ get; }
public abstract double MaxPoisoningSkill{ get; }
public BasePoisonPotion( PotionEffect effect ) : base( 0xF0A, effect )
{
}
public BasePoisonPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public void DoPoison( Mobile from )
{
from.ApplyPoison( from, Poison );
}
public override void Drink( Mobile from )
{
DoPoison( from );
BasePotion.PlayDrinkEffect( from );
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
this.Consume();
}
}
}

View file

@ -0,0 +1,36 @@
using System;
using Server;
namespace Server.Items
{
public class DeadlyPoisonPotion : BasePoisonPotion
{
public override Poison Poison{ get{ return Poison.Deadly; } }
public override double MinPoisoningSkill{ get{ return 95.0; } }
public override double MaxPoisoningSkill{ get{ return 100.0; } }
[Constructable]
public DeadlyPoisonPotion() : base( PotionEffect.PoisonDeadly )
{
}
public DeadlyPoisonPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,36 @@
using System;
using Server;
namespace Server.Items
{
public class GreaterPoisonPotion : BasePoisonPotion
{
public override Poison Poison{ get{ return Poison.Greater; } }
public override double MinPoisoningSkill{ get{ return 60.0; } }
public override double MaxPoisoningSkill{ get{ return 100.0; } }
[Constructable]
public GreaterPoisonPotion() : base( PotionEffect.PoisonGreater )
{
}
public GreaterPoisonPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,36 @@
using System;
using Server;
namespace Server.Items
{
public class LesserPoisonPotion : BasePoisonPotion
{
public override Poison Poison{ get{ return Poison.Lesser; } }
public override double MinPoisoningSkill{ get{ return 0.0; } }
public override double MaxPoisoningSkill{ get{ return 60.0; } }
[Constructable]
public LesserPoisonPotion() : base( PotionEffect.PoisonLesser )
{
}
public LesserPoisonPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,36 @@
using System;
using Server;
namespace Server.Items
{
public class PoisonPotion : BasePoisonPotion
{
public override Poison Poison{ get{ return Poison.Regular; } }
public override double MinPoisoningSkill{ get{ return 30.0; } }
public override double MaxPoisoningSkill{ get{ return 70.0; } }
[Constructable]
public PoisonPotion() : base( PotionEffect.Poison )
{
}
public PoisonPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,49 @@
using System;
using Server;
namespace Server.Items
{
public abstract class BaseRefreshPotion : BasePotion
{
public abstract double Refresh{ get; }
public BaseRefreshPotion( PotionEffect effect ) : base( 0xF0B, effect )
{
}
public BaseRefreshPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Drink( Mobile from )
{
if ( from.Stam < from.StamMax )
{
from.Stam += Scale( from, (int)(Refresh * from.StamMax) );
BasePotion.PlayDrinkEffect( from );
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
this.Consume();
}
else
{
from.SendMessage( "You decide against drinking this potion, as you are already at full stamina." );
}
}
}
}

View file

@ -0,0 +1,33 @@
using System;
using Server;
namespace Server.Items
{
public class RefreshPotion : BaseRefreshPotion
{
public override double Refresh{ get{ return 0.25; } }
[Constructable]
public RefreshPotion() : base( PotionEffect.Refresh )
{
}
public RefreshPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,33 @@
using System;
using Server;
namespace Server.Items
{
public class TotalRefreshPotion : BaseRefreshPotion
{
public override double Refresh{ get{ return 1.0; } }
[Constructable]
public TotalRefreshPotion() : base( PotionEffect.RefreshTotal )
{
}
public TotalRefreshPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,58 @@
using System;
using Server;
namespace Server.Items
{
public abstract class BaseStrengthPotion : BasePotion
{
public abstract int StrOffset{ get; }
public abstract TimeSpan Duration{ get; }
public BaseStrengthPotion( PotionEffect effect ) : base( 0xF09, effect )
{
}
public BaseStrengthPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public bool DoStrength( Mobile from )
{
// TODO: Verify scaled; is it offset, duration, or both?
if ( Spells.SpellHelper.AddStatOffset( from, StatType.Str, Scale( from, StrOffset ), Duration ) )
{
from.FixedEffect( 0x375A, 10, 15 );
from.PlaySound( 0x1E7 );
return true;
}
from.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
return false;
}
public override void Drink( Mobile from )
{
if ( DoStrength( from ) )
{
BasePotion.PlayDrinkEffect( from );
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
this.Consume();
}
}
}
}

View file

@ -0,0 +1,34 @@
using System;
using Server;
namespace Server.Items
{
public class GreaterStrengthPotion : BaseStrengthPotion
{
public override int StrOffset{ get{ return 20; } }
public override TimeSpan Duration{ get{ return TimeSpan.FromMinutes( 2.0 ); } }
[Constructable]
public GreaterStrengthPotion() : base( PotionEffect.StrengthGreater )
{
}
public GreaterStrengthPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

View file

@ -0,0 +1,34 @@
using System;
using Server;
namespace Server.Items
{
public class StrengthPotion : BaseStrengthPotion
{
public override int StrOffset{ get{ return 10; } }
public override TimeSpan Duration{ get{ return TimeSpan.FromMinutes( 2.0 ); } }
[Constructable]
public StrengthPotion() : base( PotionEffect.Strength )
{
}
public StrengthPotion( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}