Logging of staff crafting items, Fixes for the OSI client changes The potion stacking stuff BaseWeapon fix, so that damage increase things don't multiply themselves. admin gump fixes for Firewall Various display tweaks for weight SoS no longer spawn in Tokuno Hiryu hues happified to OSI standards staff now see alliance chat correctly Play barkeeper text increased per OSI Various other OSI skill requirement changes Various unimplemented features of the SE moves EventSink for when the client version is received from client. Client validation moved out of the core. Client version validation now has options to ignore/kick/warn/annoy. Automagically tries to detect current client. Reverted the delayeddamagecontext back to OSI standards. Can no longer use bags of sending in jail. MagerySpell implemented. Now only Magery spells have a circle, and various other properties of 'em. TransformationSpellHelper now implemented. Things moved around for this. Spells now need a Timespan for the cast delay, instead of arbitrarily based on Circle. Circle doesn't make sense for non-Magery spells! Alot of the spellweaving spells added to OSI standards.
213 lines
No EOL
4.3 KiB
C#
213 lines
No EOL
4.3 KiB
C#
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
|
|
}
|
|
|
|
public abstract class BasePotion : Item, ICraftable
|
|
{
|
|
private PotionEffect m_PotionEffect;
|
|
|
|
public PotionEffect PotionEffect
|
|
{
|
|
get
|
|
{
|
|
return m_PotionEffect;
|
|
}
|
|
set
|
|
{
|
|
m_PotionEffect = value;
|
|
InvalidateProperties();
|
|
}
|
|
}
|
|
|
|
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;
|
|
|
|
return ( handOne == null || handTwo == null );
|
|
}
|
|
|
|
public override void OnDoubleClick( Mobile from )
|
|
{
|
|
if ( !Movable )
|
|
return;
|
|
|
|
if ( from.InRange( this.GetWorldLocation(), 1 ) )
|
|
{
|
|
if ( !RequireFreeHand || HasFreeHand( from ) )
|
|
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 );
|
|
|
|
m.AddToBackpack( new Bottle() );
|
|
|
|
if ( m.Body.IsHuman /*&& !m.Mounted*/ )
|
|
m.Animate( 34, 5, 1, true, false, 0 );
|
|
}
|
|
|
|
public static TimeSpan Scale( Mobile m, TimeSpan v )
|
|
{
|
|
if ( !Core.AOS )
|
|
return v;
|
|
|
|
double scalar = 1.0 + (0.01 * AosAttributes.GetValue( m, AosAttribute.EnhancePotions ));
|
|
|
|
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 * AosAttributes.GetValue( m, AosAttribute.EnhancePotions ));
|
|
|
|
return v * scalar;
|
|
}
|
|
|
|
public static int Scale( Mobile m, int v )
|
|
{
|
|
if ( !Core.AOS )
|
|
return v;
|
|
|
|
return AOS.Scale( v, 100 + AosAttributes.GetValue( m, AosAttribute.EnhancePotions ) );
|
|
}
|
|
|
|
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 )
|
|
{
|
|
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
|
|
}
|
|
} |