This commit is contained in:
commit
47711d616e
2644 changed files with 479454 additions and 0 deletions
249
Scripts/Items/Containers/BaseTreasureChest.cs
Normal file
249
Scripts/Items/Containers/BaseTreasureChest.cs
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BaseTreasureChest : LockableContainer
|
||||
{
|
||||
private TreasureLevel m_TreasureLevel;
|
||||
private short m_MaxSpawnTime = 60;
|
||||
private short m_MinSpawnTime = 10;
|
||||
private TreasureResetTimer m_ResetTimer;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TreasureLevel Level
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_TreasureLevel;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_TreasureLevel = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public short MaxSpawnTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MaxSpawnTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_MaxSpawnTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public short MinSpawnTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MinSpawnTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_MinSpawnTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsDecoContainer
|
||||
{
|
||||
get{ return false; }
|
||||
}
|
||||
|
||||
public BaseTreasureChest( int itemID ) : this( itemID, TreasureLevel.Level2 )
|
||||
{
|
||||
}
|
||||
|
||||
public BaseTreasureChest( int itemID, TreasureLevel level ) : base( itemID )
|
||||
{
|
||||
m_TreasureLevel = level;
|
||||
Locked = true;
|
||||
Movable = false;
|
||||
|
||||
SetLockLevel();
|
||||
GenerateTreasure();
|
||||
}
|
||||
|
||||
public BaseTreasureChest( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( this.Locked )
|
||||
return "a locked treasure chest";
|
||||
|
||||
return "a treasure chest";
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
writer.Write( (byte) m_TreasureLevel );
|
||||
writer.Write( m_MinSpawnTime );
|
||||
writer.Write( m_MaxSpawnTime );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_TreasureLevel = (TreasureLevel)reader.ReadByte();
|
||||
m_MinSpawnTime = reader.ReadShort();
|
||||
m_MaxSpawnTime = reader.ReadShort();
|
||||
|
||||
if( !Locked )
|
||||
StartResetTimer();
|
||||
}
|
||||
|
||||
protected virtual void SetLockLevel()
|
||||
{
|
||||
switch( m_TreasureLevel )
|
||||
{
|
||||
case TreasureLevel.Level1:
|
||||
this.RequiredSkill = this.LockLevel = 5;
|
||||
break;
|
||||
|
||||
case TreasureLevel.Level2:
|
||||
this.RequiredSkill = this.LockLevel = 20;
|
||||
break;
|
||||
|
||||
case TreasureLevel.Level3:
|
||||
this.RequiredSkill = this.LockLevel = 50;
|
||||
break;
|
||||
|
||||
case TreasureLevel.Level4:
|
||||
this.RequiredSkill = this.LockLevel = 70;
|
||||
break;
|
||||
|
||||
case TreasureLevel.Level5:
|
||||
this.RequiredSkill = this.LockLevel = 90;
|
||||
break;
|
||||
|
||||
case TreasureLevel.Level6:
|
||||
this.RequiredSkill = this.LockLevel = 100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void StartResetTimer()
|
||||
{
|
||||
if( m_ResetTimer == null )
|
||||
m_ResetTimer = new TreasureResetTimer( this );
|
||||
else
|
||||
m_ResetTimer.Delay = TimeSpan.FromMinutes( Utility.Random( m_MinSpawnTime, m_MaxSpawnTime ));
|
||||
|
||||
m_ResetTimer.Start();
|
||||
}
|
||||
|
||||
protected virtual void GenerateTreasure()
|
||||
{
|
||||
int MinGold = 1;
|
||||
int MaxGold = 2;
|
||||
|
||||
switch( m_TreasureLevel )
|
||||
{
|
||||
case TreasureLevel.Level1:
|
||||
MinGold = 100;
|
||||
MaxGold = 300;
|
||||
break;
|
||||
|
||||
case TreasureLevel.Level2:
|
||||
MinGold = 300;
|
||||
MaxGold = 600;
|
||||
break;
|
||||
|
||||
case TreasureLevel.Level3:
|
||||
MinGold = 600;
|
||||
MaxGold = 900;
|
||||
break;
|
||||
|
||||
case TreasureLevel.Level4:
|
||||
MinGold = 900;
|
||||
MaxGold = 1200;
|
||||
break;
|
||||
|
||||
case TreasureLevel.Level5:
|
||||
MinGold = 1200;
|
||||
MaxGold = 5000;
|
||||
break;
|
||||
|
||||
case TreasureLevel.Level6:
|
||||
MinGold = 5000;
|
||||
MaxGold = 9000;
|
||||
break;
|
||||
}
|
||||
|
||||
DropItem( new Gold( MinGold, MaxGold ) );
|
||||
}
|
||||
|
||||
public override void LockPick( Mobile from )
|
||||
{
|
||||
base.LockPick( from );
|
||||
|
||||
StartResetTimer();
|
||||
}
|
||||
|
||||
public void ClearContents()
|
||||
{
|
||||
for ( int i = Items.Count - 1; i >= 0; --i )
|
||||
{
|
||||
if ( i < Items.Count )
|
||||
Items[i].Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
if( m_ResetTimer != null )
|
||||
{
|
||||
if( m_ResetTimer.Running )
|
||||
m_ResetTimer.Stop();
|
||||
}
|
||||
|
||||
Locked = true;
|
||||
ClearContents();
|
||||
GenerateTreasure();
|
||||
}
|
||||
|
||||
public enum TreasureLevel
|
||||
{
|
||||
Level1,
|
||||
Level2,
|
||||
Level3,
|
||||
Level4,
|
||||
Level5,
|
||||
Level6,
|
||||
};
|
||||
|
||||
private class TreasureResetTimer : Timer
|
||||
{
|
||||
private BaseTreasureChest m_Chest;
|
||||
|
||||
public TreasureResetTimer( BaseTreasureChest chest ) : base ( TimeSpan.FromMinutes( Utility.Random( chest.MinSpawnTime, chest.MaxSpawnTime ) ) )
|
||||
{
|
||||
m_Chest = chest;
|
||||
Priority = TimerPriority.OneMinute;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Chest.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
891
Scripts/Items/Containers/Container.cs
Normal file
891
Scripts/Items/Containers/Container.cs
Normal file
|
|
@ -0,0 +1,891 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Multis;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseContainer : Container
|
||||
{
|
||||
public override int DefaultMaxWeight
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( IsSecure )
|
||||
return 0;
|
||||
|
||||
return base.DefaultMaxWeight;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseContainer( int itemID ) : base( itemID )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsAccessibleTo( Mobile m )
|
||||
{
|
||||
if ( !BaseHouse.CheckAccessible( m, this ) )
|
||||
return false;
|
||||
|
||||
return base.IsAccessibleTo( m );
|
||||
}
|
||||
|
||||
public override bool CheckHold( Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight )
|
||||
{
|
||||
if ( this.IsSecure && !BaseHouse.CheckHold( m, this, item, message, checkItems, plusItems, plusWeight ) )
|
||||
return false;
|
||||
|
||||
return base.CheckHold( m, item, message, checkItems, plusItems, plusWeight );
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
SetSecureLevelEntry.AddTo( from, this, list );
|
||||
}
|
||||
|
||||
public override bool TryDropItem( Mobile from, Item dropped, bool sendFullMessage )
|
||||
{
|
||||
if ( !CheckHold( from, dropped, sendFullMessage, true ) )
|
||||
return false;
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
if ( house != null && house.IsLockedDown( this ) )
|
||||
{
|
||||
if ( dropped is VendorRentalContract || ( dropped is Container && ((Container)dropped).FindItemByType( typeof( VendorRentalContract ) ) != null ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062492 ); // You cannot place a rental contract in a locked down container.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !house.LockDown( from, dropped, false ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Item> list = this.Items;
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
Item item = list[i];
|
||||
|
||||
if ( !(item is Container) && item.StackWith( from, dropped, false ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
DropItem( dropped );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto( Mobile from, Item item, Point3D p )
|
||||
{
|
||||
if ( !CheckHold( from, item, true, true ) )
|
||||
return false;
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
if ( house != null && house.IsLockedDown( this ) )
|
||||
{
|
||||
if ( item is VendorRentalContract || ( item is Container && ((Container)item).FindItemByType( typeof( VendorRentalContract ) ) != null ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062492 ); // You cannot place a rental contract in a locked down container.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !house.LockDown( from, item, false ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
item.Location = new Point3D( p.X, p.Y, 0 );
|
||||
AddItem( item );
|
||||
|
||||
from.SendSound( GetDroppedSound( item ), GetWorldLocation() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel > AccessLevel.Player || from.InRange( this.GetWorldLocation(), 2 ) || this.RootParent is PlayerVendor )
|
||||
Open( from );
|
||||
else
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
}
|
||||
|
||||
public virtual void Open( Mobile from )
|
||||
{
|
||||
DisplayTo( from );
|
||||
}
|
||||
|
||||
public BaseContainer( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
/* Note: base class insertion; we cannot serialize anything here */
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
}
|
||||
}
|
||||
|
||||
public class StrongBackpack : Backpack //Used on Pack animals
|
||||
{
|
||||
[Constructable]
|
||||
public StrongBackpack()
|
||||
{
|
||||
Layer = Layer.Backpack;
|
||||
Weight = 3.0;
|
||||
}
|
||||
|
||||
public override bool CheckHold( Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight )
|
||||
{
|
||||
return base.CheckHold( m, item, false, checkItems, plusItems, plusWeight );
|
||||
}
|
||||
|
||||
public override int DefaultMaxWeight{ get{ return 1600; } }
|
||||
|
||||
public override bool CheckContentDisplay( Mobile from )
|
||||
{
|
||||
object root = this.RootParent;
|
||||
|
||||
if ( root is BaseCreature && ((BaseCreature)root).Controlled && ((BaseCreature)root).ControlMaster == from )
|
||||
return true;
|
||||
|
||||
return base.CheckContentDisplay( from );
|
||||
}
|
||||
|
||||
public StrongBackpack( 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 class Backpack : BaseContainer, IDyable
|
||||
{
|
||||
[Constructable]
|
||||
public Backpack() : base( 0xE75 )
|
||||
{
|
||||
Layer = Layer.Backpack;
|
||||
Weight = 3.0;
|
||||
}
|
||||
|
||||
public Backpack( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public bool Dye( Mobile from, DyeTub sender )
|
||||
{
|
||||
if ( Deleted ) return false;
|
||||
|
||||
Hue = sender.DyedHue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version == 0 && ItemID == 0x9B2 )
|
||||
ItemID = 0xE75;
|
||||
}
|
||||
}
|
||||
|
||||
public class Pouch : TrapableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public Pouch() : base( 0xE79 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public Pouch( 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 abstract class BaseBagBall : BaseContainer, IDyable
|
||||
{
|
||||
public BaseBagBall( int itemID ) : base( itemID )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public BaseBagBall( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public bool Dye( Mobile from, DyeTub sender )
|
||||
{
|
||||
if ( Deleted )
|
||||
return false;
|
||||
|
||||
Hue = sender.DyedHue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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 class SmallBagBall : BaseBagBall
|
||||
{
|
||||
[Constructable]
|
||||
public SmallBagBall() : base( 0x2256 )
|
||||
{
|
||||
}
|
||||
|
||||
public SmallBagBall( 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 class LargeBagBall : BaseBagBall
|
||||
{
|
||||
[Constructable]
|
||||
public LargeBagBall() : base( 0x2257 )
|
||||
{
|
||||
}
|
||||
|
||||
public LargeBagBall( 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 class Bag : BaseContainer, IDyable
|
||||
{
|
||||
[Constructable]
|
||||
public Bag() : base( 0xE76 )
|
||||
{
|
||||
Weight = 2.0;
|
||||
}
|
||||
|
||||
public Bag( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public bool Dye( Mobile from, DyeTub sender )
|
||||
{
|
||||
if ( Deleted ) return false;
|
||||
|
||||
Hue = sender.DyedHue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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 class Barrel : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public Barrel() : base( 0xE77 )
|
||||
{
|
||||
Weight = 25.0;
|
||||
}
|
||||
|
||||
public Barrel( 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();
|
||||
|
||||
if ( Weight == 0.0 )
|
||||
Weight = 25.0;
|
||||
}
|
||||
}
|
||||
|
||||
public class Keg : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public Keg() : base( 0xE7F )
|
||||
{
|
||||
Weight = 15.0;
|
||||
}
|
||||
|
||||
public Keg( 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 class PicnicBasket : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public PicnicBasket() : base( 0xE7A )
|
||||
{
|
||||
Weight = 2.0; // Stratics doesn't know weight
|
||||
}
|
||||
|
||||
public PicnicBasket( 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 class Basket : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public Basket() : base( 0x990 )
|
||||
{
|
||||
Weight = 1.0; // Stratics doesn't know weight
|
||||
}
|
||||
|
||||
public Basket( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x9AA, 0xE7D )]
|
||||
public class WoodenBox : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public WoodenBox() : base( 0x9AA )
|
||||
{
|
||||
Weight = 4.0;
|
||||
}
|
||||
|
||||
public WoodenBox( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x9A9, 0xE7E )]
|
||||
public class SmallCrate : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public SmallCrate() : base( 0x9A9 )
|
||||
{
|
||||
Weight = 2.0;
|
||||
}
|
||||
|
||||
public SmallCrate( 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();
|
||||
|
||||
if ( Weight == 4.0 )
|
||||
Weight = 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0xE3F, 0xE3E )]
|
||||
public class MediumCrate : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public MediumCrate() : base( 0xE3F )
|
||||
{
|
||||
Weight = 2.0;
|
||||
}
|
||||
|
||||
public MediumCrate( 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();
|
||||
|
||||
if ( Weight == 6.0 )
|
||||
Weight = 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0xE3D, 0xE3C )]
|
||||
public class LargeCrate : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public LargeCrate() : base( 0xE3D )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public LargeCrate( 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();
|
||||
|
||||
if ( Weight == 8.0 )
|
||||
Weight = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
[DynamicFliping]
|
||||
[Flipable( 0x9A8, 0xE80 )]
|
||||
public class MetalBox : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public MetalBox() : base( 0x9A8 )
|
||||
{
|
||||
}
|
||||
|
||||
public MetalBox( 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();
|
||||
|
||||
if ( version == 0 && Weight == 3 )
|
||||
Weight = -1;
|
||||
}
|
||||
}
|
||||
|
||||
[DynamicFliping]
|
||||
[Flipable( 0x9AB, 0xE7C )]
|
||||
public class MetalChest : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public MetalChest() : base( 0x9AB )
|
||||
{
|
||||
}
|
||||
|
||||
public MetalChest( 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();
|
||||
|
||||
if ( version == 0 && Weight == 25 )
|
||||
Weight = -1;
|
||||
}
|
||||
}
|
||||
|
||||
[DynamicFliping]
|
||||
[Flipable( 0xE41, 0xE40 )]
|
||||
public class MetalGoldenChest : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public MetalGoldenChest() : base( 0xE41 )
|
||||
{
|
||||
}
|
||||
|
||||
public MetalGoldenChest( 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();
|
||||
|
||||
if ( version == 0 && Weight == 25 )
|
||||
Weight = -1;
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0xe43, 0xe42 )]
|
||||
public class WoodenChest : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public WoodenChest() : base( 0xe43 )
|
||||
{
|
||||
Weight = 2.0;
|
||||
}
|
||||
|
||||
public WoodenChest( 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();
|
||||
|
||||
if ( Weight == 15.0 )
|
||||
Weight = 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x280B, 0x280C )]
|
||||
public class PlainWoodenChest : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public PlainWoodenChest() : base( 0x280B )
|
||||
{
|
||||
}
|
||||
|
||||
public PlainWoodenChest( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version == 0 && Weight == 15 )
|
||||
Weight = -1;
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x280D, 0x280E )]
|
||||
public class OrnateWoodenChest : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public OrnateWoodenChest() : base( 0x280D )
|
||||
{
|
||||
}
|
||||
|
||||
public OrnateWoodenChest( 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();
|
||||
|
||||
if ( version == 0 && Weight == 15 )
|
||||
Weight = -1;
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x280F, 0x2810 )]
|
||||
public class GildedWoodenChest : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public GildedWoodenChest() : base( 0x280F )
|
||||
{
|
||||
}
|
||||
|
||||
public GildedWoodenChest( 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();
|
||||
|
||||
if ( version == 0 && Weight == 15 )
|
||||
Weight = -1;
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x2811, 0x2812 )]
|
||||
public class WoodenFootLocker : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public WoodenFootLocker() : base( 0x2811 )
|
||||
{
|
||||
}
|
||||
|
||||
public WoodenFootLocker( 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();
|
||||
|
||||
if ( version == 0 && Weight == 15 )
|
||||
Weight = -1;
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x2813, 0x2814 )]
|
||||
public class FinishedWoodenChest : LockableContainer
|
||||
{
|
||||
[Constructable]
|
||||
public FinishedWoodenChest() : base( 0x2813 )
|
||||
{
|
||||
}
|
||||
|
||||
public FinishedWoodenChest( 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();
|
||||
|
||||
if ( version == 0 && Weight == 15 )
|
||||
Weight = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
1502
Scripts/Items/Containers/FillableContainers.cs
Normal file
1502
Scripts/Items/Containers/FillableContainers.cs
Normal file
File diff suppressed because it is too large
Load diff
428
Scripts/Items/Containers/FurnitureContainer.cs
Normal file
428
Scripts/Items/Containers/FurnitureContainer.cs
Normal file
|
|
@ -0,0 +1,428 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Furniture]
|
||||
[Flipable( 0x2815, 0x2816 )]
|
||||
public class TallCabinet : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public TallCabinet() : base( 0x2815 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public TallCabinet( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x2817, 0x2818 )]
|
||||
public class ShortCabinet : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public ShortCabinet() : base( 0x2817 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public ShortCabinet( 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x2857, 0x2858 )]
|
||||
public class RedArmoire : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public RedArmoire() : base( 0x2857 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public RedArmoire( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x285D, 0x285E )]
|
||||
public class CherryArmoire : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public CherryArmoire() : base( 0x285D )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public CherryArmoire( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x285B, 0x285C )]
|
||||
public class MapleArmoire : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public MapleArmoire() : base( 0x285B )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public MapleArmoire( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0x2859, 0x285A )]
|
||||
public class ElegantArmoire : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public ElegantArmoire() : base( 0x2859 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public ElegantArmoire( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0xa97, 0xa99, 0xa98, 0xa9a, 0xa9b, 0xa9c )]
|
||||
public class FullBookcase : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public FullBookcase() : base( 0xA97 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public FullBookcase( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0xa9d, 0xa9e )]
|
||||
public class EmptyBookcase : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public EmptyBookcase() : base( 0xA9D )
|
||||
{
|
||||
}
|
||||
|
||||
public EmptyBookcase( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version == 0 && Weight == 1.0 )
|
||||
Weight = -1;
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0xa2c, 0xa34 )]
|
||||
public class Drawer : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public Drawer() : base( 0xA2C )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public Drawer( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0xa30, 0xa38 )]
|
||||
public class FancyDrawer : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public FancyDrawer() : base( 0xA30 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public FancyDrawer( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0xa4f, 0xa53 )]
|
||||
public class Armoire : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public Armoire() : base( 0xA4F )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public override void DisplayTo( Mobile m )
|
||||
{
|
||||
if ( DynamicFurniture.Open( this, m ) )
|
||||
base.DisplayTo( m );
|
||||
}
|
||||
|
||||
public Armoire( 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();
|
||||
|
||||
DynamicFurniture.Close( this );
|
||||
}
|
||||
}
|
||||
|
||||
[Furniture]
|
||||
[Flipable( 0xa4d, 0xa51 )]
|
||||
public class FancyArmoire : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public FancyArmoire() : base( 0xA4D )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public override void DisplayTo( Mobile m )
|
||||
{
|
||||
if ( DynamicFurniture.Open( this, m ) )
|
||||
base.DisplayTo( m );
|
||||
}
|
||||
|
||||
public FancyArmoire( 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();
|
||||
|
||||
DynamicFurniture.Close( this );
|
||||
}
|
||||
}
|
||||
|
||||
public class DynamicFurniture
|
||||
{
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
|
||||
public static bool Open( Container c, Mobile m )
|
||||
{
|
||||
if ( m_Table.Contains( c ) )
|
||||
{
|
||||
c.SendRemovePacket();
|
||||
Close( c );
|
||||
c.Delta( ItemDelta.Update );
|
||||
c.ProcessDelta();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( c is Armoire || c is FancyArmoire )
|
||||
{
|
||||
Timer t = new FurnitureTimer( c, m );
|
||||
t.Start();
|
||||
m_Table[c] = t;
|
||||
|
||||
switch ( c.ItemID )
|
||||
{
|
||||
case 0xA4D: c.ItemID = 0xA4C; break;
|
||||
case 0xA4F: c.ItemID = 0xA4E; break;
|
||||
case 0xA51: c.ItemID = 0xA50; break;
|
||||
case 0xA53: c.ItemID = 0xA52; break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void Close( Container c )
|
||||
{
|
||||
Timer t = (Timer)m_Table[c];
|
||||
|
||||
if ( t != null )
|
||||
{
|
||||
t.Stop();
|
||||
m_Table.Remove( c );
|
||||
}
|
||||
|
||||
if ( c is Armoire || c is FancyArmoire )
|
||||
{
|
||||
switch ( c.ItemID )
|
||||
{
|
||||
case 0xA4C: c.ItemID = 0xA4D; break;
|
||||
case 0xA4E: c.ItemID = 0xA4F; break;
|
||||
case 0xA50: c.ItemID = 0xA51; break;
|
||||
case 0xA52: c.ItemID = 0xA53; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class FurnitureTimer : Timer
|
||||
{
|
||||
private Container m_Container;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public FurnitureTimer( Container c, Mobile m ) : base( TimeSpan.FromSeconds( 0.5 ), TimeSpan.FromSeconds( 0.5 ) )
|
||||
{
|
||||
Priority = TimerPriority.TwoFiftyMS;
|
||||
|
||||
m_Container = c;
|
||||
m_Mobile = m;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if ( m_Mobile.Map != m_Container.Map || !m_Mobile.InRange( m_Container.GetWorldLocation(), 3 ) )
|
||||
DynamicFurniture.Close( m_Container );
|
||||
}
|
||||
}
|
||||
}
|
||||
376
Scripts/Items/Containers/LockableContainer.cs
Normal file
376
Scripts/Items/Containers/LockableContainer.cs
Normal file
|
|
@ -0,0 +1,376 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
using Server.Items;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class LockableContainer : TrapableContainer, ILockable, ILockpickable, ICraftable//, ITelekinesisable
|
||||
{
|
||||
private bool m_Locked;
|
||||
private int m_LockLevel, m_MaxLockLevel, m_RequiredSkill;
|
||||
private uint m_KeyValue;
|
||||
private Mobile m_Picker;
|
||||
private bool m_TrapOnLockpick;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Picker
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Picker;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Picker = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int MaxLockLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MaxLockLevel;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_MaxLockLevel = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int LockLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_LockLevel;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_LockLevel = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int RequiredSkill
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_RequiredSkill;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_RequiredSkill = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public virtual bool Locked
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Locked;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Locked = value;
|
||||
|
||||
if ( m_Locked )
|
||||
m_Picker = null;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public uint KeyValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_KeyValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_KeyValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool TrapOnOpen
|
||||
{
|
||||
get
|
||||
{
|
||||
return !m_TrapOnLockpick;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool TrapOnLockpick
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_TrapOnLockpick;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_TrapOnLockpick = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 5 ); // version
|
||||
|
||||
writer.Write( (bool) m_TrapOnLockpick );
|
||||
|
||||
writer.Write( (int) m_RequiredSkill );
|
||||
|
||||
writer.Write( (int) m_MaxLockLevel );
|
||||
|
||||
writer.Write( m_KeyValue );
|
||||
writer.Write( (int) m_LockLevel );
|
||||
writer.Write( (bool) m_Locked );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 5:
|
||||
{
|
||||
m_TrapOnLockpick = reader.ReadBool();
|
||||
|
||||
goto case 4;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
m_RequiredSkill = reader.ReadInt();
|
||||
|
||||
goto case 3;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
m_MaxLockLevel = reader.ReadInt();
|
||||
|
||||
goto case 2;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
m_KeyValue = reader.ReadUInt();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_LockLevel = reader.ReadInt();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
if ( version < 3 )
|
||||
m_MaxLockLevel = 100;
|
||||
|
||||
if ( version < 4 )
|
||||
{
|
||||
if ( (m_MaxLockLevel - m_LockLevel) == 40 )
|
||||
{
|
||||
m_RequiredSkill = m_LockLevel + 6;
|
||||
m_LockLevel = m_RequiredSkill - 10;
|
||||
m_MaxLockLevel = m_RequiredSkill + 39;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RequiredSkill = m_LockLevel;
|
||||
}
|
||||
}
|
||||
|
||||
m_Locked = reader.ReadBool();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LockableContainer( int itemID ) : base( itemID )
|
||||
{
|
||||
m_MaxLockLevel = 100;
|
||||
}
|
||||
|
||||
public LockableContainer( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool CheckContentDisplay( Mobile from )
|
||||
{
|
||||
return !m_Locked && base.CheckContentDisplay( from );
|
||||
}
|
||||
|
||||
public override bool TryDropItem( Mobile from, Item dropped, bool sendFullMessage )
|
||||
{
|
||||
if ( from.AccessLevel < AccessLevel.GameMaster && m_Locked )
|
||||
{
|
||||
from.SendLocalizedMessage( 501747 ); // It appears to be locked.
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.TryDropItem( from, dropped, sendFullMessage );
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto( Mobile from, Item item, Point3D p )
|
||||
{
|
||||
if ( from.AccessLevel < AccessLevel.GameMaster && m_Locked )
|
||||
{
|
||||
from.SendLocalizedMessage( 501747 ); // It appears to be locked.
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnDragDropInto( from, item, p );
|
||||
}
|
||||
|
||||
public override bool CheckLift( Mobile from, Item item, ref LRReason reject )
|
||||
{
|
||||
if ( !base.CheckLift( from, item, ref reject ) )
|
||||
return false;
|
||||
|
||||
if ( item != this && from.AccessLevel < AccessLevel.GameMaster && m_Locked )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool CheckItemUse( Mobile from, Item item )
|
||||
{
|
||||
if ( !base.CheckItemUse( from, item ) )
|
||||
return false;
|
||||
|
||||
if ( item != this && from.AccessLevel < AccessLevel.GameMaster && m_Locked )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DisplaysContent{ get{ return !m_Locked; } }
|
||||
|
||||
public virtual bool CheckLocked( Mobile from )
|
||||
{
|
||||
bool inaccessible = false;
|
||||
|
||||
if ( m_Locked )
|
||||
{
|
||||
int number;
|
||||
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
{
|
||||
number = 502502; // That is locked, but you open it with your godly powers.
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 501747; // It appears to be locked.
|
||||
inaccessible = true;
|
||||
}
|
||||
|
||||
from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", "" ) );
|
||||
}
|
||||
|
||||
return inaccessible;
|
||||
}
|
||||
|
||||
public override void OnTelekinesis( Mobile from )
|
||||
{
|
||||
if ( CheckLocked( from ) )
|
||||
{
|
||||
Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5022 );
|
||||
Effects.PlaySound( Location, Map, 0x1F5 );
|
||||
return;
|
||||
}
|
||||
|
||||
base.OnTelekinesis( from );
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade( Mobile from )
|
||||
{
|
||||
if ( CheckLocked( from ) )
|
||||
return;
|
||||
|
||||
base.OnDoubleClickSecureTrade( from );
|
||||
}
|
||||
|
||||
public override void Open( Mobile from )
|
||||
{
|
||||
if ( CheckLocked( from ) )
|
||||
return;
|
||||
|
||||
base.Open( from );
|
||||
}
|
||||
|
||||
public override void OnSnoop( Mobile from )
|
||||
{
|
||||
if ( CheckLocked( from ) )
|
||||
return;
|
||||
|
||||
base.OnSnoop( from );
|
||||
}
|
||||
|
||||
public virtual void LockPick( Mobile from )
|
||||
{
|
||||
Locked = false;
|
||||
Picker = from;
|
||||
|
||||
if ( this.TrapOnLockpick && ExecuteTrap( from ) )
|
||||
{
|
||||
this.TrapOnLockpick = false;
|
||||
}
|
||||
}
|
||||
|
||||
#region ICraftable Members
|
||||
|
||||
public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
|
||||
{
|
||||
if ( from.CheckSkill( SkillName.Tinkering, -5.0, 15.0 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500636 ); // Your tinker skill was sufficient to make the item lockable.
|
||||
|
||||
Key key = new Key( KeyType.Copper, Key.RandomValue() );
|
||||
|
||||
KeyValue = key.KeyValue;
|
||||
DropItem( key );
|
||||
|
||||
double tinkering = from.Skills[SkillName.Tinkering].Value;
|
||||
int level = (int)(tinkering * 0.8);
|
||||
|
||||
RequiredSkill = level - 4;
|
||||
LockLevel = level - 14;
|
||||
MaxLockLevel = level + 35;
|
||||
|
||||
if ( LockLevel == 0 )
|
||||
LockLevel = -1;
|
||||
else if ( LockLevel > 95 )
|
||||
LockLevel = 95;
|
||||
|
||||
if ( RequiredSkill > 95 )
|
||||
RequiredSkill = 95;
|
||||
|
||||
if ( MaxLockLevel > 95 )
|
||||
MaxLockLevel = 95;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 500637 ); // Your tinker skill was insufficient to make the item lockable.
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
267
Scripts/Items/Containers/MarkContainer.cs
Normal file
267
Scripts/Items/Containers/MarkContainer.cs
Normal file
|
|
@ -0,0 +1,267 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MarkContainer : LockableContainer
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "SecretLocGen", AccessLevel.Administrator, new CommandEventHandler( SecretLocGen_OnCommand ) );
|
||||
}
|
||||
|
||||
[Usage( "SecretLocGen" )]
|
||||
[Description( "Generates mark containers to Malas secret locations." )]
|
||||
public static void SecretLocGen_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
CreateMalasPassage( 951, 546, -70, 1006, 994, -70, false, false );
|
||||
CreateMalasPassage( 914, 192, -79, 1019, 1062, -70, false, false );
|
||||
CreateMalasPassage( 1614, 143, -90, 1214, 1313, -90, false, false );
|
||||
CreateMalasPassage( 2176, 324, -90, 1554, 172, -90, false, false );
|
||||
CreateMalasPassage( 864, 812, -90, 1061, 1161, -70, false, false );
|
||||
CreateMalasPassage( 1051, 1434, -85, 1076, 1244, -70, false, true );
|
||||
CreateMalasPassage( 1326, 523, -87, 1201, 1554, -70, false, false );
|
||||
CreateMalasPassage( 424, 189, -1, 2333, 1501, -90, true, false );
|
||||
CreateMalasPassage( 1313, 1115, -85, 1183, 462, -45, false, false );
|
||||
|
||||
e.Mobile.SendMessage( "Secret mark containers have been created." );
|
||||
}
|
||||
|
||||
private static bool FindMarkContainer( Point3D p, Map map )
|
||||
{
|
||||
IPooledEnumerable eable = map.GetItemsInRange( p, 0 );
|
||||
|
||||
foreach ( Item item in eable )
|
||||
{
|
||||
if ( item.Z == p.Z && item is MarkContainer )
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void CreateMalasPassage( int x, int y, int z, int xTarget, int yTarget, int zTarget, bool bone, bool locked )
|
||||
{
|
||||
Point3D location = new Point3D( x, y, z );
|
||||
|
||||
if ( FindMarkContainer( location, Map.Malas ) )
|
||||
return;
|
||||
|
||||
MarkContainer cont = new MarkContainer( bone, locked );
|
||||
cont.TargetMap = Map.Malas;
|
||||
cont.Target = new Point3D( xTarget, yTarget, zTarget );
|
||||
cont.Description = "strange location";
|
||||
|
||||
cont.MoveToWorld( location, Map.Malas );
|
||||
}
|
||||
|
||||
private bool m_AutoLock;
|
||||
private InternalTimer m_RelockTimer;
|
||||
private Map m_TargetMap;
|
||||
private Point3D m_Target;
|
||||
private string m_Description;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool AutoLock
|
||||
{
|
||||
get { return m_AutoLock; }
|
||||
set
|
||||
{
|
||||
m_AutoLock = value;
|
||||
|
||||
if ( !m_AutoLock )
|
||||
StopTimer();
|
||||
else if ( !Locked && m_RelockTimer == null )
|
||||
m_RelockTimer = new InternalTimer( this );
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Map TargetMap { get { return m_TargetMap; } set { m_TargetMap = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Target { get { return m_Target; } set { m_Target = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Bone
|
||||
{
|
||||
get { return ItemID == 0xECA; }
|
||||
set
|
||||
{
|
||||
ItemID = value ? 0xECA : 0xE79;
|
||||
Hue = value ? 1102 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Description { get { return m_Description; } set { m_Description = value; } }
|
||||
|
||||
public override bool IsDecoContainer
|
||||
{
|
||||
get{ return false; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public MarkContainer() : this( false )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public MarkContainer( bool bone ) : this( bone, false )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public MarkContainer( bool bone, bool locked ) : base( bone ? 0xECA : 0xE79 )
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
if ( bone )
|
||||
Hue = 1102;
|
||||
|
||||
m_AutoLock = locked;
|
||||
Locked = locked;
|
||||
|
||||
if ( locked )
|
||||
LockLevel = -255;
|
||||
}
|
||||
|
||||
public MarkContainer( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public override bool Locked
|
||||
{
|
||||
get { return base.Locked; }
|
||||
set
|
||||
{
|
||||
base.Locked = value;
|
||||
|
||||
if ( m_AutoLock )
|
||||
{
|
||||
StopTimer();
|
||||
|
||||
if ( !Locked )
|
||||
m_RelockTimer = new InternalTimer( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StopTimer()
|
||||
{
|
||||
if ( m_RelockTimer != null )
|
||||
m_RelockTimer.Stop();
|
||||
|
||||
m_RelockTimer = null;
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private MarkContainer m_Container;
|
||||
private DateTime m_RelockTime;
|
||||
|
||||
public MarkContainer Container { get { return m_Container; } }
|
||||
public DateTime RelockTime { get { return m_RelockTime; } }
|
||||
|
||||
public InternalTimer( MarkContainer container ) : this( container, TimeSpan.FromMinutes( 5.0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public InternalTimer( MarkContainer container, TimeSpan delay ) : base( delay )
|
||||
{
|
||||
m_Container = container;
|
||||
m_RelockTime = DateTime.Now + delay;
|
||||
|
||||
Start();
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Container.Locked = true;
|
||||
m_Container.LockLevel = -255;
|
||||
}
|
||||
}
|
||||
|
||||
public void Mark( RecallRune rune )
|
||||
{
|
||||
if ( TargetMap != null )
|
||||
{
|
||||
rune.Marked = true;
|
||||
rune.TargetMap = m_TargetMap;
|
||||
rune.Target = m_Target;
|
||||
rune.Description = m_Description;
|
||||
rune.House = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
RecallRune rune = dropped as RecallRune;
|
||||
|
||||
if ( rune != null && base.OnDragDrop( from, dropped ) )
|
||||
{
|
||||
Mark( rune );
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto( Mobile from, Item dropped, Point3D p )
|
||||
{
|
||||
RecallRune rune = dropped as RecallRune;
|
||||
|
||||
if ( rune != null && base.OnDragDropInto( from, dropped, p ) )
|
||||
{
|
||||
Mark( rune );
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int)0 ); // version
|
||||
|
||||
writer.Write( m_AutoLock );
|
||||
|
||||
if ( !Locked && m_AutoLock )
|
||||
writer.WriteDeltaTime( m_RelockTimer.RelockTime );
|
||||
|
||||
writer.Write( m_TargetMap );
|
||||
writer.Write( m_Target );
|
||||
writer.Write( m_Description );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_AutoLock = reader.ReadBool();
|
||||
|
||||
if ( !Locked && m_AutoLock )
|
||||
m_RelockTimer = new InternalTimer( this, reader.ReadDeltaTime() - DateTime.Now );
|
||||
|
||||
m_TargetMap = reader.ReadMap();
|
||||
m_Target = reader.ReadPoint3D();
|
||||
m_Description = reader.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
207
Scripts/Items/Containers/ParagonChest.cs
Normal file
207
Scripts/Items/Containers/ParagonChest.cs
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.PartySystem;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ParagonChest : LockableContainer
|
||||
{
|
||||
public override int LabelNumber{ get{ return 3000541; } }
|
||||
|
||||
private static int[] m_ItemIDs = new int[]
|
||||
{
|
||||
0x9AB, 0xE40, 0xE41, 0xE7C
|
||||
};
|
||||
|
||||
private static int[] m_Hues = new int[]
|
||||
{
|
||||
0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB,
|
||||
0x966, 0x96D, 0x972, 0x973, 0x979,
|
||||
};
|
||||
|
||||
private string m_Name;
|
||||
|
||||
[Constructable]
|
||||
public ParagonChest( string name, int level ) : base( Utility.RandomList( m_ItemIDs ) )
|
||||
{
|
||||
m_Name = name;
|
||||
Hue = Utility.RandomList( m_Hues );
|
||||
Fill( level );
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
LabelTo( from, 1063449, m_Name );
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1063449, m_Name );
|
||||
}
|
||||
|
||||
private static void GetRandomAOSStats( out int attributeCount, out int min, out int max )
|
||||
{
|
||||
int rnd = Utility.Random( 15 );
|
||||
|
||||
if ( rnd < 1 )
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax( 2, 6 );
|
||||
min = 20; max = 70;
|
||||
}
|
||||
else if ( rnd < 3 )
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax( 2, 4 );
|
||||
min = 20; max = 50;
|
||||
}
|
||||
else if ( rnd < 6 )
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax( 2, 3 );
|
||||
min = 20; max = 40;
|
||||
}
|
||||
else if ( rnd < 10 )
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax( 1, 2 );
|
||||
min = 10; max = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
attributeCount = 1;
|
||||
min = 10; max = 20;
|
||||
}
|
||||
}
|
||||
|
||||
private void Fill( int level )
|
||||
{
|
||||
TrapType = TrapType.ExplosionTrap;
|
||||
TrapPower = level * 25;
|
||||
TrapLevel = level;
|
||||
Locked = true;
|
||||
|
||||
switch ( level )
|
||||
{
|
||||
case 1: RequiredSkill = 36; break;
|
||||
case 2: RequiredSkill = 76; break;
|
||||
case 3: RequiredSkill = 84; break;
|
||||
case 4: RequiredSkill = 92; break;
|
||||
case 5: RequiredSkill = 100; break;
|
||||
}
|
||||
|
||||
LockLevel = RequiredSkill - 10;
|
||||
MaxLockLevel = RequiredSkill + 40;
|
||||
|
||||
DropItem( new Gold( level * 200 ) );
|
||||
|
||||
for ( int i = 0; i < level; ++i )
|
||||
DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );
|
||||
|
||||
for ( int i = 0; i < level * 2; ++i )
|
||||
{
|
||||
Item item;
|
||||
|
||||
if ( Core.AOS )
|
||||
item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
|
||||
else
|
||||
item = Loot.RandomArmorOrShieldOrWeapon();
|
||||
|
||||
if ( item is BaseWeapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
|
||||
}
|
||||
else
|
||||
{
|
||||
weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
|
||||
weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
|
||||
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
|
||||
DropItem( item );
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
|
||||
}
|
||||
else
|
||||
{
|
||||
armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
|
||||
armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
|
||||
DropItem( item );
|
||||
}
|
||||
else if ( item is BaseJewel )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );
|
||||
|
||||
DropItem( item );
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < level; i++ )
|
||||
{
|
||||
Item item = Loot.RandomPossibleReagent();
|
||||
item.Amount = Utility.RandomMinMax( 40, 60 );
|
||||
DropItem( item );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < level; i++ )
|
||||
{
|
||||
Item item = Loot.RandomGem();
|
||||
DropItem( item );
|
||||
}
|
||||
|
||||
DropItem( new TreasureMap( level + 1, ( Utility.RandomBool() ? Map.Felucca : Map.Trammel ) ) );
|
||||
}
|
||||
|
||||
public ParagonChest( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Name );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Name = Utility.Intern( reader.ReadString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
167
Scripts/Items/Containers/Strongbox.cs
Normal file
167
Scripts/Items/Containers/Strongbox.cs
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[FlipableAttribute( 0xe80, 0x9a8 )]
|
||||
public class StrongBox : BaseContainer, IChopable
|
||||
{
|
||||
private Mobile m_Owner;
|
||||
private BaseHouse m_House;
|
||||
|
||||
public StrongBox( Mobile owner, BaseHouse house ) : base( 0xE80 )
|
||||
{
|
||||
m_Owner = owner;
|
||||
m_House = house;
|
||||
|
||||
MaxItems = 25;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Owner;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Owner = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override int DefaultMaxWeight{ get{ return 0; } }
|
||||
|
||||
public StrongBox( Serial serial ) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Owner );
|
||||
writer.Write( m_House );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Owner = reader.ReadMobile();
|
||||
m_House = reader.ReadItem() as BaseHouse;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( Validate ) );
|
||||
}
|
||||
|
||||
private void Validate()
|
||||
{
|
||||
if ( m_Owner != null && m_House != null && !m_House.IsCoOwner( m_Owner ) )
|
||||
{
|
||||
Console.WriteLine( "Warning: Destroying strongbox of {0}", m_Owner.Name );
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Decays
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_House != null && m_Owner != null && !m_Owner.Deleted )
|
||||
return !m_House.IsCoOwner( m_Owner );
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override TimeSpan DecayTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return TimeSpan.FromMinutes( 30.0 );
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty( ObjectPropertyList list )
|
||||
{
|
||||
if ( m_Owner != null )
|
||||
list.Add( 1042887, m_Owner.Name ); // a strong box owned by ~1_OWNER_NAME~
|
||||
else
|
||||
base.AddNameProperty( list );
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
if ( m_Owner != null )
|
||||
{
|
||||
LabelTo( from, 1042887, m_Owner.Name ); // a strong box owned by ~1_OWNER_NAME~
|
||||
|
||||
if ( CheckContentDisplay( from ) )
|
||||
LabelTo( from, "({0} items, {1} stones)", TotalItems, TotalWeight );
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsAccessibleTo( Mobile m )
|
||||
{
|
||||
if ( m_Owner == null || m_Owner.Deleted || m_House == null || m_House.Deleted || m.AccessLevel >= AccessLevel.GameMaster )
|
||||
return true;
|
||||
|
||||
return m == m_Owner && m_House.IsCoOwner( m ) && base.IsAccessibleTo( m );
|
||||
}
|
||||
|
||||
private void Chop( Mobile from )
|
||||
{
|
||||
Effects.PlaySound( Location, Map, 0x3B3 );
|
||||
from.SendLocalizedMessage( 500461 ); // You destroy the item.
|
||||
Destroy();
|
||||
}
|
||||
|
||||
public void OnChop( Mobile from )
|
||||
{
|
||||
if ( m_House != null && !m_House.Deleted && m_Owner != null && !m_Owner.Deleted )
|
||||
{
|
||||
if ( from == m_Owner || m_House.IsOwner( from ) )
|
||||
Chop( from );
|
||||
}
|
||||
else
|
||||
{
|
||||
Chop( from );
|
||||
}
|
||||
}
|
||||
|
||||
public Container ConvertToStandardContainer()
|
||||
{
|
||||
Container metalBox = new MetalBox();
|
||||
ArrayList subItems = new ArrayList( Items );
|
||||
|
||||
foreach ( Item subItem in subItems )
|
||||
{
|
||||
metalBox.AddItem( subItem );
|
||||
}
|
||||
|
||||
this.Delete();
|
||||
|
||||
return metalBox;
|
||||
}
|
||||
}
|
||||
}
|
||||
258
Scripts/Items/Containers/TrapableContainer.cs
Normal file
258
Scripts/Items/Containers/TrapableContainer.cs
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum TrapType
|
||||
{
|
||||
None,
|
||||
MagicTrap,
|
||||
ExplosionTrap,
|
||||
DartTrap,
|
||||
PoisonTrap
|
||||
}
|
||||
|
||||
public abstract class TrapableContainer : BaseContainer, ITelekinesisable
|
||||
{
|
||||
private TrapType m_TrapType;
|
||||
private int m_TrapPower;
|
||||
private int m_TrapLevel;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TrapType TrapType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_TrapType;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_TrapType = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TrapPower
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_TrapPower;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_TrapPower = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TrapLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_TrapLevel;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_TrapLevel = value;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool TrapOnOpen{ get{ return true; } }
|
||||
|
||||
public TrapableContainer( int itemID ) : base( itemID )
|
||||
{
|
||||
}
|
||||
|
||||
public TrapableContainer( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
private void SendMessageTo( Mobile to, int number, int hue )
|
||||
{
|
||||
if ( Deleted || !to.CanSee( this ) )
|
||||
return;
|
||||
|
||||
to.Send( new Network.MessageLocalized( Serial, ItemID, Network.MessageType.Regular, hue, 3, number, "", "" ) );
|
||||
}
|
||||
|
||||
private void SendMessageTo( Mobile to, string text, int hue )
|
||||
{
|
||||
if ( Deleted || !to.CanSee( this ) )
|
||||
return;
|
||||
|
||||
to.Send( new Network.UnicodeMessage( Serial, ItemID, Network.MessageType.Regular, hue, 3, "ENU", "", text ) );
|
||||
}
|
||||
|
||||
public virtual bool ExecuteTrap( Mobile from )
|
||||
{
|
||||
if ( m_TrapType != TrapType.None )
|
||||
{
|
||||
Point3D loc = this.GetWorldLocation();
|
||||
Map facet = this.Map;
|
||||
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
{
|
||||
SendMessageTo( from, "That is trapped, but you open it with your godly powers.", 0x3B2 );
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ( m_TrapType )
|
||||
{
|
||||
case TrapType.ExplosionTrap:
|
||||
{
|
||||
SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!
|
||||
|
||||
if ( from.InRange( loc, 3 ) )
|
||||
{
|
||||
int damage;
|
||||
|
||||
if ( m_TrapLevel > 0 )
|
||||
damage = Utility.RandomMinMax( 10, 30 ) * m_TrapLevel;
|
||||
else
|
||||
damage = m_TrapPower;
|
||||
|
||||
AOS.Damage( from, damage, 0, 100, 0, 0, 0 );
|
||||
|
||||
// Your skin blisters from the heat!
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x2A, 503000 );
|
||||
}
|
||||
|
||||
Effects.SendLocationEffect( loc, facet, 0x36BD, 15, 10 );
|
||||
Effects.PlaySound( loc, facet, 0x307 );
|
||||
|
||||
break;
|
||||
}
|
||||
case TrapType.MagicTrap:
|
||||
{
|
||||
if ( from.InRange( loc, 1 ) )
|
||||
from.Damage( m_TrapPower );
|
||||
//AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
|
||||
|
||||
Effects.PlaySound( loc, Map, 0x307 );
|
||||
|
||||
Effects.SendLocationEffect( new Point3D( loc.X - 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );
|
||||
Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );
|
||||
|
||||
Effects.SendLocationEffect( new Point3D( loc.X, loc.Y - 1, loc.Z ), Map, 0x36BD, 15 );
|
||||
Effects.SendLocationEffect( new Point3D( loc.X, loc.Y + 1, loc.Z ), Map, 0x36BD, 15 );
|
||||
|
||||
Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z + 11 ), Map, 0x36BD, 15 );
|
||||
|
||||
break;
|
||||
}
|
||||
case TrapType.DartTrap:
|
||||
{
|
||||
SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!
|
||||
|
||||
if ( from.InRange( loc, 3 ) )
|
||||
{
|
||||
int damage;
|
||||
|
||||
if ( m_TrapLevel > 0 )
|
||||
damage = Utility.RandomMinMax( 5, 15 ) * m_TrapLevel;
|
||||
else
|
||||
damage = m_TrapPower;
|
||||
|
||||
AOS.Damage( from, damage, 100, 0, 0, 0, 0 );
|
||||
|
||||
// A dart imbeds itself in your flesh!
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x62, 502998 );
|
||||
}
|
||||
|
||||
Effects.PlaySound( loc, facet, 0x223 );
|
||||
|
||||
break;
|
||||
}
|
||||
case TrapType.PoisonTrap:
|
||||
{
|
||||
SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!
|
||||
|
||||
if ( from.InRange( loc, 3 ) )
|
||||
{
|
||||
Poison poison;
|
||||
|
||||
if ( m_TrapLevel > 0 )
|
||||
{
|
||||
poison = Poison.GetPoison( Math.Max( 0, Math.Min( 4, m_TrapLevel - 1 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
AOS.Damage( from, m_TrapPower, 0, 0, 0, 100, 0 );
|
||||
poison = Poison.Greater;
|
||||
}
|
||||
|
||||
from.ApplyPoison( from, poison );
|
||||
|
||||
// You are enveloped in a noxious green cloud!
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x44, 503004 );
|
||||
}
|
||||
|
||||
Effects.SendLocationEffect( loc, facet, 0x113A, 10, 20 );
|
||||
Effects.PlaySound( loc, facet, 0x231 );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_TrapType = TrapType.None;
|
||||
m_TrapPower = 0;
|
||||
m_TrapLevel = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void OnTelekinesis( Mobile from )
|
||||
{
|
||||
Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5022 );
|
||||
Effects.PlaySound( Location, Map, 0x1F5 );
|
||||
|
||||
if ( !this.TrapOnOpen || !ExecuteTrap( from ) )
|
||||
base.DisplayTo( from );
|
||||
}
|
||||
|
||||
public override void Open( Mobile from )
|
||||
{
|
||||
if ( !this.TrapOnOpen || !ExecuteTrap( from ) )
|
||||
base.Open( from );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 2 ); // version
|
||||
|
||||
writer.Write( (int) m_TrapLevel );
|
||||
|
||||
writer.Write( (int) m_TrapPower );
|
||||
writer.Write( (int) m_TrapType );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
m_TrapLevel = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_TrapPower = reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_TrapType = (TrapType)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
89
Scripts/Items/Containers/TreasureChest.cs
Normal file
89
Scripts/Items/Containers/TreasureChest.cs
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[FlipableAttribute( 0xe43, 0xe42 )]
|
||||
public class WoodenTreasureChest : BaseTreasureChest
|
||||
{
|
||||
[Constructable]
|
||||
public WoodenTreasureChest() : base( 0xE43 )
|
||||
{
|
||||
}
|
||||
|
||||
public WoodenTreasureChest( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[FlipableAttribute( 0xe41, 0xe40 )]
|
||||
public class MetalGoldenTreasureChest : BaseTreasureChest
|
||||
{
|
||||
[Constructable]
|
||||
public MetalGoldenTreasureChest() : base( 0xE41 )
|
||||
{
|
||||
}
|
||||
|
||||
public MetalGoldenTreasureChest( 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();
|
||||
}
|
||||
}
|
||||
|
||||
[FlipableAttribute( 0x9ab, 0xe7c )]
|
||||
public class MetalTreasureChest : BaseTreasureChest
|
||||
{
|
||||
[Constructable]
|
||||
public MetalTreasureChest() : base( 0x9AB )
|
||||
{
|
||||
}
|
||||
|
||||
public MetalTreasureChest( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
508
Scripts/Items/Containers/TreasureMapChest.cs
Normal file
508
Scripts/Items/Containers/TreasureMapChest.cs
Normal file
|
|
@ -0,0 +1,508 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.PartySystem;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TreasureMapChest : LockableContainer
|
||||
{
|
||||
public override int LabelNumber{ get{ return 3000541; } }
|
||||
|
||||
public static Type[] Artifacts { get { return m_Artifacts; } }
|
||||
|
||||
private static Type[] m_Artifacts = new Type[]
|
||||
{
|
||||
typeof( CandelabraOfSouls ), typeof( GoldBricks ), typeof( PhillipsWoodenSteed ),
|
||||
typeof( ArcticDeathDealer ), typeof( BlazeOfDeath ), typeof( BurglarsBandana ),
|
||||
typeof( CavortingClub ), typeof( DreadPirateHat ),
|
||||
typeof( EnchantedTitanLegBone ), typeof( GwennosHarp ), typeof( IolosLute ),
|
||||
typeof( LunaLance ), typeof( NightsKiss ), typeof( NoxRangersHeavyCrossbow ),
|
||||
typeof( PolarBearMask ), typeof( VioletCourage ), typeof( HeartOfTheLion ),
|
||||
typeof( ColdBlood ), typeof( AlchemistsBauble )
|
||||
};
|
||||
|
||||
private int m_Level;
|
||||
private DateTime m_DeleteTime;
|
||||
private Timer m_Timer;
|
||||
private Mobile m_Owner;
|
||||
private bool m_Temporary;
|
||||
|
||||
private ArrayList m_Guardians;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Level{ get{ return m_Level; } set{ m_Level = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Owner{ get{ return m_Owner; } set{ m_Owner = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime DeleteTime{ get{ return m_DeleteTime; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Temporary{ get{ return m_Temporary; } set{ m_Temporary = value; } }
|
||||
|
||||
public ArrayList Guardians{ get{ return m_Guardians; } }
|
||||
|
||||
[Constructable]
|
||||
public TreasureMapChest( int level ) : this( null, level, false )
|
||||
{
|
||||
}
|
||||
|
||||
public TreasureMapChest( Mobile owner, int level, bool temporary ) : base( 0xE40 )
|
||||
{
|
||||
m_Owner = owner;
|
||||
m_Level = level;
|
||||
m_DeleteTime = DateTime.Now + TimeSpan.FromHours( 3.0 );
|
||||
|
||||
m_Temporary = temporary;
|
||||
m_Guardians = new ArrayList();
|
||||
|
||||
m_Timer = new DeleteTimer( this, m_DeleteTime );
|
||||
m_Timer.Start();
|
||||
|
||||
Fill( this, level );
|
||||
}
|
||||
|
||||
private static void GetRandomAOSStats( out int attributeCount, out int min, out int max )
|
||||
{
|
||||
int rnd = Utility.Random( 15 );
|
||||
|
||||
if ( rnd < 1 )
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax( 2, 6 );
|
||||
min = 20; max = 70;
|
||||
}
|
||||
else if ( rnd < 3 )
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax( 2, 4 );
|
||||
min = 20; max = 50;
|
||||
}
|
||||
else if ( rnd < 6 )
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax( 2, 3 );
|
||||
min = 20; max = 40;
|
||||
}
|
||||
else if ( rnd < 10 )
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax( 1, 2 );
|
||||
min = 10; max = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
attributeCount = 1;
|
||||
min = 10; max = 20;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Fill( LockableContainer cont, int level )
|
||||
{
|
||||
cont.Movable = false;
|
||||
cont.Locked = true;
|
||||
|
||||
if ( level == 0 )
|
||||
{
|
||||
cont.LockLevel = 0; // Can't be unlocked
|
||||
|
||||
cont.DropItem( new Gold( Utility.RandomMinMax( 50, 100 ) ) );
|
||||
|
||||
if ( Utility.RandomDouble() < 0.75 )
|
||||
cont.DropItem( new TreasureMap( 0, Map.Trammel ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
cont.TrapType = TrapType.ExplosionTrap;
|
||||
cont.TrapPower = level * 25;
|
||||
cont.TrapLevel = level;
|
||||
|
||||
switch ( level )
|
||||
{
|
||||
case 1: cont.RequiredSkill = 36; break;
|
||||
case 2: cont.RequiredSkill = 76; break;
|
||||
case 3: cont.RequiredSkill = 84; break;
|
||||
case 4: cont.RequiredSkill = 92; break;
|
||||
case 5: cont.RequiredSkill = 100; break;
|
||||
case 6: cont.RequiredSkill = 100; break;
|
||||
}
|
||||
|
||||
cont.LockLevel = cont.RequiredSkill - 10;
|
||||
cont.MaxLockLevel = cont.RequiredSkill + 40;
|
||||
|
||||
cont.DropItem( new Gold( level * 1000 ) );
|
||||
|
||||
for ( int i = 0; i < level * 5; ++i )
|
||||
cont.DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );
|
||||
|
||||
for ( int i = 0; i < level * 6; ++i )
|
||||
{
|
||||
Item item;
|
||||
|
||||
if ( Core.AOS )
|
||||
item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
|
||||
else
|
||||
item = Loot.RandomArmorOrShieldOrWeapon();
|
||||
|
||||
if ( item is BaseWeapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
|
||||
}
|
||||
else
|
||||
{
|
||||
weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
|
||||
weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
|
||||
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
|
||||
cont.DropItem( item );
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
|
||||
}
|
||||
else
|
||||
{
|
||||
armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
|
||||
armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
|
||||
cont.DropItem( item );
|
||||
}
|
||||
else if ( item is BaseJewel )
|
||||
{
|
||||
int attributeCount;
|
||||
int min, max;
|
||||
|
||||
GetRandomAOSStats( out attributeCount, out min, out max );
|
||||
|
||||
BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );
|
||||
|
||||
cont.DropItem( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int reagents;
|
||||
if ( level == 0 )
|
||||
reagents = 12;
|
||||
else
|
||||
reagents = level * 3;
|
||||
|
||||
for ( int i = 0; i < reagents; i++ )
|
||||
{
|
||||
Item item = Loot.RandomPossibleReagent();
|
||||
item.Amount = Utility.RandomMinMax( 40, 60 );
|
||||
cont.DropItem( item );
|
||||
}
|
||||
|
||||
int gems;
|
||||
if ( level == 0 )
|
||||
gems = 2;
|
||||
else
|
||||
gems = level * 3;
|
||||
|
||||
for ( int i = 0; i < gems; i++ )
|
||||
{
|
||||
Item item = Loot.RandomGem();
|
||||
cont.DropItem( item );
|
||||
}
|
||||
|
||||
if ( level == 6 && Core.AOS )
|
||||
cont.DropItem( (Item)Activator.CreateInstance( m_Artifacts[Utility.Random(m_Artifacts.Length)] ) );
|
||||
}
|
||||
|
||||
public override bool CheckLocked( Mobile from )
|
||||
{
|
||||
if ( !this.Locked )
|
||||
return false;
|
||||
|
||||
if ( this.Level == 0 && from.AccessLevel < AccessLevel.GameMaster )
|
||||
{
|
||||
foreach ( Mobile m in this.Guardians )
|
||||
{
|
||||
if ( m.Alive )
|
||||
{
|
||||
from.SendLocalizedMessage( 1046448 ); // You must first kill the guardians before you may open this chest.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
LockPick( from );
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.CheckLocked( from );
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList m_Lifted = new ArrayList();
|
||||
|
||||
private bool CheckLoot( Mobile m, bool criminalAction )
|
||||
{
|
||||
if ( m_Temporary )
|
||||
return false;
|
||||
|
||||
if ( m.AccessLevel >= AccessLevel.GameMaster || m_Owner == null || m == m_Owner )
|
||||
return true;
|
||||
|
||||
Party p = Party.Get( m_Owner );
|
||||
|
||||
if ( p != null && p.Contains( m ) )
|
||||
return true;
|
||||
|
||||
Map map = this.Map;
|
||||
|
||||
if ( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 )
|
||||
{
|
||||
if ( criminalAction )
|
||||
m.CriminalAction( true );
|
||||
else
|
||||
m.SendLocalizedMessage( 1010630 ); // Taking someone else's treasure is a criminal offense!
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
m.SendLocalizedMessage( 1010631 ); // You did not discover this chest!
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsDecoContainer
|
||||
{
|
||||
get{ return false; }
|
||||
}
|
||||
|
||||
public override bool CheckItemUse( Mobile from, Item item )
|
||||
{
|
||||
return CheckLoot( from, item != this ) && base.CheckItemUse( from, item );
|
||||
}
|
||||
|
||||
public override bool CheckLift( Mobile from, Item item, ref LRReason reject )
|
||||
{
|
||||
return CheckLoot( from, true ) && base.CheckLift( from, item, ref reject );
|
||||
}
|
||||
|
||||
public override void OnItemLifted( Mobile from, Item item )
|
||||
{
|
||||
bool notYetLifted = !m_Lifted.Contains( item );
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
if ( notYetLifted )
|
||||
{
|
||||
m_Lifted.Add( item );
|
||||
|
||||
if ( 0.1 >= Utility.RandomDouble() ) // 10% chance to spawn a new monster
|
||||
TreasureMap.Spawn( m_Level, GetWorldLocation(), Map, from, false );
|
||||
}
|
||||
|
||||
base.OnItemLifted( from, item );
|
||||
}
|
||||
|
||||
public override bool CheckHold( Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight )
|
||||
{
|
||||
if ( m.AccessLevel < AccessLevel.GameMaster )
|
||||
{
|
||||
m.SendLocalizedMessage( 1048122, "", 0x8A5 ); // The chest refuses to be filled with treasure again.
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckHold( m, item, message, checkItems, plusItems, plusWeight );
|
||||
}
|
||||
|
||||
public TreasureMapChest( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 2 ); // version
|
||||
|
||||
writer.WriteMobileList( m_Guardians, true );
|
||||
writer.Write( (bool) m_Temporary );
|
||||
|
||||
writer.Write( m_Owner );
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
writer.WriteDeltaTime( m_DeleteTime );
|
||||
writer.WriteItemList( m_Lifted, true );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
m_Guardians = reader.ReadMobileList();
|
||||
m_Temporary = reader.ReadBool();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Owner = reader.ReadMobile();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Level = reader.ReadInt();
|
||||
m_DeleteTime = reader.ReadDeltaTime();
|
||||
m_Lifted = reader.ReadItemList();
|
||||
|
||||
if ( version < 2 )
|
||||
m_Guardians = new ArrayList();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !m_Temporary )
|
||||
{
|
||||
m_Timer = new DeleteTimer( this, m_DeleteTime );
|
||||
m_Timer.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
|
||||
if ( from.Alive )
|
||||
list.Add( new RemoveEntry( from, this ) );
|
||||
}
|
||||
|
||||
public void BeginRemove( Mobile from )
|
||||
{
|
||||
if ( !from.Alive )
|
||||
return;
|
||||
|
||||
from.CloseGump( typeof( RemoveGump ) );
|
||||
from.SendGump( new RemoveGump( from, this ) );
|
||||
}
|
||||
|
||||
public void EndRemove( Mobile from )
|
||||
{
|
||||
if ( Deleted || from != m_Owner || !from.InRange( GetWorldLocation(), 3 ) )
|
||||
return;
|
||||
|
||||
from.SendLocalizedMessage( 1048124, "", 0x8A5 ); // The old, rusted chest crumbles when you hit it.
|
||||
this.Delete();
|
||||
}
|
||||
|
||||
private class RemoveGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private TreasureMapChest m_Chest;
|
||||
|
||||
public RemoveGump( Mobile from, TreasureMapChest chest ) : base( 15, 15 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Chest = chest;
|
||||
|
||||
Closable = false;
|
||||
Disposable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 30, 0, 240, 240, 2620 );
|
||||
|
||||
AddHtmlLocalized( 45, 15, 200, 80, 1048125, 0xFFFFFF, false, false ); // When this treasure chest is removed, any items still inside of it will be lost.
|
||||
AddHtmlLocalized( 45, 95, 200, 60, 1048126, 0xFFFFFF, false, false ); // Are you certain you're ready to remove this chest?
|
||||
|
||||
AddButton( 40, 153, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 75, 155, 180, 40, 1048127, 0xFFFFFF, false, false ); // Remove the Treasure Chest
|
||||
|
||||
AddButton( 40, 195, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 75, 197, 180, 35, 1006045, 0xFFFFFF, false, false ); // Cancel
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID == 1 )
|
||||
m_Chest.EndRemove( m_From );
|
||||
}
|
||||
}
|
||||
|
||||
private class RemoveEntry : ContextMenuEntry
|
||||
{
|
||||
private Mobile m_From;
|
||||
private TreasureMapChest m_Chest;
|
||||
|
||||
public RemoveEntry( Mobile from, TreasureMapChest chest ) : base( 6149, 3 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Chest = chest;
|
||||
|
||||
Enabled = ( from == chest.Owner );
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
if ( m_Chest.Deleted || m_From != m_Chest.Owner || !m_From.CheckAlive() )
|
||||
return;
|
||||
|
||||
m_Chest.BeginRemove( m_From );
|
||||
}
|
||||
}
|
||||
|
||||
private class DeleteTimer : Timer
|
||||
{
|
||||
private Item m_Item;
|
||||
|
||||
public DeleteTimer( Item item, DateTime time ) : base( time - DateTime.Now )
|
||||
{
|
||||
m_Item = item;
|
||||
Priority = TimerPriority.OneMinute;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue