This commit is contained in:
mark 2009-09-06 02:06:07 +00:00
parent 4ee6ca5951
commit 06e5c8b732
70 changed files with 2798 additions and 286 deletions

View file

@ -12,7 +12,6 @@ namespace Server.Items
Valid,
Blocked,
NotInHouse,
DoorsNotClosed,
DoorTooClose,
NoWall
}
@ -142,9 +141,6 @@ namespace Server.Items
{
BaseDoor door = doors[i] as BaseDoor;
if ( door != null && door.Open )
return AddonFitResult.DoorsNotClosed;
Point3D doorLoc = door.GetWorldLocation();
int doorHeight = door.ItemData.CalcHeight;

View file

@ -83,8 +83,6 @@ namespace Server.Items
from.SendLocalizedMessage( 500269 ); // You cannot build that there.
else if ( res == AddonFitResult.NotInHouse )
from.SendLocalizedMessage( 500274 ); // You can only place this in a house that you own!
else if ( res == AddonFitResult.DoorsNotClosed )
from.SendMessage( "You must close all house doors before placing this." );
else if ( res == AddonFitResult.DoorTooClose )
from.SendLocalizedMessage( 500271 ); // You cannot build near the door.
else if ( res == AddonFitResult.NoWall )

View file

@ -564,13 +564,13 @@ namespace Server.Items
CraftItem item = system.CraftItems.SearchFor( GetType() );
if ( item != null && item.Ressources.Count == 1 && item.Ressources.GetAt( 0 ).Amount >= 2 )
if ( item != null && item.Resources.Count == 1 && item.Resources.GetAt( 0 ).Amount >= 2 )
{
try
{
Item res = (Item)Activator.CreateInstance( CraftResources.GetInfo( m_Resource ).ResourceTypes[0] );
ScissorHelper( from, res, m_PlayerConstructed ? (item.Ressources.GetAt( 0 ).Amount / 2) : 1 );
ScissorHelper( from, res, m_PlayerConstructed ? (item.Resources.GetAt( 0 ).Amount / 2) : 1 );
return true;
}
catch
@ -1602,7 +1602,7 @@ namespace Server.Items
Type resourceType = typeRes;
if ( resourceType == null )
resourceType = craftItem.Ressources.GetAt( 0 ).ItemType;
resourceType = craftItem.Resources.GetAt( 0 ).ItemType;
Resource = CraftResources.GetFromType( resourceType );
PlayerConstructed = true;

View file

@ -475,6 +475,26 @@ namespace Server.Items
return ( m_AosAttributes.SpellChanneling != 0 );
}
public void UnscaleDurability()
{
int scale = 100 + m_AosClothingAttributes.DurabilityBonus;
m_HitPoints = ( ( m_HitPoints * 100 ) + ( scale - 1 ) ) / scale;
m_MaxHitPoints = ( ( m_MaxHitPoints * 100 ) + ( scale - 1 ) ) / scale;
InvalidateProperties();
}
public void ScaleDurability()
{
int scale = 100 + m_AosClothingAttributes.DurabilityBonus;
m_HitPoints = ( ( m_HitPoints * scale ) + 99 ) / 100;
m_MaxHitPoints = ( ( m_MaxHitPoints * scale ) + 99 ) / 100;
InvalidateProperties();
}
public override bool CheckPropertyConfliction( Mobile m )
{
if ( base.CheckPropertyConfliction( m ) )
@ -931,7 +951,7 @@ namespace Server.Items
CraftItem item = system.CraftItems.SearchFor( GetType() );
if ( item != null && item.Ressources.Count == 1 && item.Ressources.GetAt( 0 ).Amount >= 2 )
if ( item != null && item.Resources.Count == 1 && item.Resources.GetAt( 0 ).Amount >= 2 )
{
try
{
@ -943,11 +963,11 @@ namespace Server.Items
resourceType = info.ResourceTypes[0];
if ( resourceType == null )
resourceType = item.Ressources.GetAt( 0 ).ItemType;
resourceType = item.Resources.GetAt( 0 ).ItemType;
Item res = (Item)Activator.CreateInstance( resourceType );
ScissorHelper( from, res, m_PlayerConstructed ? (item.Ressources.GetAt( 0 ).Amount / 2) : 1 );
ScissorHelper( from, res, m_PlayerConstructed ? (item.Resources.GetAt( 0 ).Amount / 2) : 1 );
res.LootType = LootType.Regular;
@ -993,7 +1013,7 @@ namespace Server.Items
Type resourceType = typeRes;
if ( resourceType == null )
resourceType = craftItem.Ressources.GetAt( 0 ).ItemType;
resourceType = craftItem.Resources.GetAt( 0 ).ItemType;
Resource = CraftResources.GetFromType( resourceType );
}

View file

@ -107,6 +107,14 @@ namespace Server.Items
return true;
}
public override void UpdateTotal( Item sender, TotalType type, int delta )
{
base.UpdateTotal( sender, type, delta );
if ( type == TotalType.Weight && RootParent is Mobile )
((Mobile) RootParent).InvalidateProperties();
}
public override void OnDoubleClick( Mobile from )
{
if ( from.AccessLevel > AccessLevel.Player || from.InRange( this.GetWorldLocation(), 2 ) || this.RootParent is PlayerVendor )
@ -142,7 +150,7 @@ namespace Server.Items
public StrongBackpack()
{
Layer = Layer.Backpack;
Weight = 3.0;
Weight = 13.0;
}
public override bool CheckHold( Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight )
@ -170,7 +178,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) 1 ); // version
}
public override void Deserialize( GenericReader reader )
@ -178,6 +186,9 @@ namespace Server.Items
base.Deserialize( reader );
int version = reader.ReadInt();
if ( version == 0 )
Weight = 13.0;
}
}

View file

@ -66,7 +66,7 @@ namespace Server.Items
}
}
if ( !( m_Commodity is ICommodity ) ) //Apparently, there may be items out there with this. Funky.
if ( m_Commodity != null && !( m_Commodity is ICommodity ) ) //Apparently, there may be items out there with this. Funky.
{
Timer.DelayCall( TimeSpan.Zero, this.Delete );
}
@ -101,7 +101,7 @@ namespace Server.Items
public override int LabelNumber{ get{ return m_Commodity == null ? 1047016 : 1047017; } }
public override void GetProperties(ObjectPropertyList list)
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );

View file

@ -132,7 +132,7 @@ namespace Server.Items
Type resourceType = typeRes;
if ( resourceType == null )
resourceType = craftItem.Ressources.GetAt( 0 ).ItemType;
resourceType = craftItem.Resources.GetAt( 0 ).ItemType;
Resource = CraftResources.GetFromType( resourceType );

View file

@ -759,6 +759,17 @@ namespace Server.Items
from.SendLocalizedMessage( 1010089 ); // You fill the container with water.
}
else if ( targ is Cow )
{
Cow cow = (Cow)targ;
if ( cow.TryMilk( from ) )
{
Content = BeverageType.Milk;
Quantity = MaxQuantity;
from.SendLocalizedMessage( 1080197 ); // You fill the container with milk.
}
}
else if ( targ is LandTarget )
{
int tileID = ((LandTarget)targ).TileID;

View file

@ -375,7 +375,7 @@ namespace Server.Items
Type resourceType = typeRes;
if ( resourceType == null )
resourceType = craftItem.Ressources.GetAt( 0 ).ItemType;
resourceType = craftItem.Resources.GetAt( 0 ).ItemType;
Resource = CraftResources.GetFromType( resourceType );
@ -384,9 +384,9 @@ namespace Server.Items
if ( context != null && context.DoNotColor )
Hue = 0;
if ( 1 < craftItem.Ressources.Count )
if ( 1 < craftItem.Resources.Count )
{
resourceType = craftItem.Ressources.GetAt( 1 ).ItemType;
resourceType = craftItem.Resources.GetAt( 1 ).ItemType;
if ( resourceType == typeof( StarSapphire ) )
GemType = GemType.StarSapphire;

View file

@ -5,13 +5,16 @@ namespace Server.Items
{
interface IDurability
{
bool CanFortify { get; }
int InitMinHits { get; }
int InitMaxHits { get; }
int HitPoints { get; set; }
int MaxHitPoints { get; set; }
//Maybe a scale/unscale durability?
void ScaleDurability();
void UnscaleDurability();
}
interface IWearableDurability : IDurability

View file

@ -15,16 +15,9 @@ namespace Server.Items
}
[Constructable]
public OilCloth() : this( 1 )
{
}
[Constructable]
public OilCloth( int amount ) : base( 0x175D )
public OilCloth() : base( 0x175D )
{
Hue = 2001;
Stackable = true;
Amount = amount;
}
public bool Dye( Mobile from, DyeTub sender )

View file

@ -106,186 +106,71 @@ namespace Server.Items
return;
}
if ( targeted is BaseArmor /*&& (DefBlacksmithy.CraftSystem.CraftItems.SearchForSubclass( targeted.GetType() ) != null)*/ )
if ( targeted is IDurability && targeted is Item )
{
BaseArmor ar = (BaseArmor)targeted;
IDurability wearable = (IDurability) targeted;
Item item = (Item) targeted;
if ( !ar.CanFortify )
if ( !wearable.CanFortify )
{
from.SendLocalizedMessage( 1049083 ); // You cannot use the powder on that item.
return;
}
if ( ar.IsChildOf( from.Backpack ) && m_Powder.IsChildOf( from.Backpack ) )
if ( item.IsChildOf( from.Backpack ) && m_Powder.IsChildOf( from.Backpack ) )
{
int origMaxHP = ar.MaxHitPoints;
int origCurHP = ar.HitPoints;
int origMaxHP = wearable.MaxHitPoints;
int origCurHP = wearable.HitPoints;
int initMaxHP = Core.AOS ? 255 : ar.InitMaxHits;
ar.UnscaleDurability();
if ( ar.MaxHitPoints < initMaxHP )
if ( origMaxHP > 0 )
{
int bonus = initMaxHP - ar.MaxHitPoints;
int initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;
if ( bonus > 10 )
bonus = 10;
wearable.UnscaleDurability();
ar.MaxHitPoints += bonus;
ar.HitPoints += bonus;
ar.ScaleDurability();
if ( ar.MaxHitPoints > 255 ) ar.MaxHitPoints = 255;
if ( ar.HitPoints > 255 ) ar.HitPoints = 255;
if ( ar.MaxHitPoints > origMaxHP )
if ( wearable.MaxHitPoints < initMaxHP )
{
from.SendLocalizedMessage( 1049084 ); // You successfully use the powder on the item.
int bonus = initMaxHP - wearable.MaxHitPoints;
--m_Powder.UsesRemaining;
if ( bonus > 10 )
bonus = 10;
if ( m_Powder.UsesRemaining <= 0 )
wearable.MaxHitPoints += bonus;
wearable.HitPoints += bonus;
wearable.ScaleDurability();
if ( wearable.MaxHitPoints > 255 ) wearable.MaxHitPoints = 255;
if ( wearable.HitPoints > 255 ) wearable.HitPoints = 255;
if ( wearable.MaxHitPoints > origMaxHP )
{
from.SendLocalizedMessage( 1049086 ); // You have used up your powder of temperament.
m_Powder.Delete();
from.SendLocalizedMessage( 1049084 ); // You successfully use the powder on the item.
--m_Powder.UsesRemaining;
if ( m_Powder.UsesRemaining <= 0 )
{
from.SendLocalizedMessage( 1049086 ); // You have used up your powder of temperament.
m_Powder.Delete();
}
}
else
{
wearable.MaxHitPoints = origMaxHP;
wearable.HitPoints = origCurHP;
from.SendLocalizedMessage( 1049085 ); // The item cannot be improved any further.
}
}
else
{
ar.MaxHitPoints = origMaxHP;
ar.HitPoints = origCurHP;
from.SendLocalizedMessage( 1049085 ); // The item cannot be improved any further.
wearable.ScaleDurability();
}
}
else
{
from.SendLocalizedMessage( 1049085 ); // The item cannot be improved any further.
ar.ScaleDurability();
}
}
else
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
}
else if ( targeted is BaseWeapon /*&& (DefBlacksmithy.CraftSystem.CraftItems.SearchForSubclass( targeted.GetType() ) != null)*/ )
{
BaseWeapon wep = (BaseWeapon)targeted;
if ( !wep.CanFortify )
{
from.SendLocalizedMessage( 1049083 ); // You cannot use the powder on that item.
return;
}
if ( wep.IsChildOf( from.Backpack ) && m_Powder.IsChildOf( from.Backpack ) )
{
int origMaxHP = wep.MaxHitPoints;
int origCurHP = wep.HitPoints;
int initMaxHP = Core.AOS ? 255 : wep.InitMaxHits;
wep.UnscaleDurability();
if ( wep.MaxHitPoints < initMaxHP )
{
int bonus = initMaxHP - wep.MaxHitPoints;
if ( bonus > 10 )
bonus = 10;
wep.MaxHitPoints += bonus;
wep.HitPoints += bonus;
wep.ScaleDurability();
if ( wep.MaxHitPoints > 255 ) wep.MaxHitPoints = 255;
if ( wep.HitPoints > 255 ) wep.HitPoints = 255;
if ( wep.MaxHitPoints > origMaxHP )
{
from.SendLocalizedMessage( 1049084 ); // You successfully use the powder on the item.
--m_Powder.UsesRemaining;
if ( m_Powder.UsesRemaining <= 0 )
{
from.SendLocalizedMessage( 1049086 ); // You have used up your powder of temperament.
m_Powder.Delete();
}
}
else
{
wep.MaxHitPoints = origMaxHP;
wep.HitPoints = origCurHP;
from.SendLocalizedMessage( 1049085 ); // The item cannot be improved any further.
}
}
else
{
from.SendLocalizedMessage( 1049085 ); // The item cannot be improved any further.
wep.ScaleDurability();
}
}
else
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
}
else if ( targeted is BaseClothing /*&& (DefBlacksmithy.CraftSystem.CraftItems.SearchForSubclass( targeted.GetType() ) != null)*/ )
{
BaseClothing clothing = (BaseClothing)targeted;
if ( !clothing.CanFortify )
{
from.SendLocalizedMessage( 1049083 ); // You cannot use the powder on that item.
return;
}
if ( clothing.IsChildOf( from.Backpack ) && m_Powder.IsChildOf( from.Backpack ) )
{
int origMaxHP = clothing.MaxHitPoints;
int origCurHP = clothing.HitPoints;
int initMaxHP = Core.AOS ? 255 : clothing.InitMaxHits;
if ( clothing.MaxHitPoints < initMaxHP )
{
int bonus = initMaxHP - clothing.MaxHitPoints;
if ( bonus > 10 )
bonus = 10;
clothing.MaxHitPoints += bonus;
clothing.HitPoints += bonus;
if ( clothing.MaxHitPoints > 255 ) clothing.MaxHitPoints = 255;
if ( clothing.HitPoints > 255 ) clothing.HitPoints = 255;
if ( clothing.MaxHitPoints > origMaxHP )
{
from.SendLocalizedMessage( 1049084 ); // You successfully use the powder on the item.
--m_Powder.UsesRemaining;
if ( m_Powder.UsesRemaining <= 0 )
{
from.SendLocalizedMessage( 1049086 ); // You have used up your powder of temperament.
m_Powder.Delete();
}
}
else
{
clothing.MaxHitPoints = origMaxHP;
clothing.HitPoints = origCurHP;
from.SendLocalizedMessage( 1049085 ); // The item cannot be improved any further.
}
}
else
{
from.SendLocalizedMessage( 1049085 ); // The item cannot be improved any further.
from.SendLocalizedMessage( 1049083 ); // You cannot use the powder on that item.
}
}
else