本文整理汇总了C#中Server.Items.TrashBarrel类的典型用法代码示例。如果您正苦于以下问题:C# TrashBarrel类的具体用法?C# TrashBarrel怎么用?C# TrashBarrel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TrashBarrel类属于Server.Items命名空间,在下文中一共展示了TrashBarrel类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RestoreRelocatedEntities
public void RestoreRelocatedEntities()
{
foreach ( RelocatedEntity relocEntity in RelocatedEntities )
{
Point3D relLoc = relocEntity.RelativeLocation;
Point3D location = new Point3D( relLoc.X + this.X, relLoc.Y + this.Y, relLoc.Z + this.Z );
IEntity entity = relocEntity.Entity;
if ( entity is Item )
{
Item item = (Item) entity;
if ( !item.Deleted )
{
if ( item is IAddon )
{
if ( ((IAddon)item).CouldFit( location, this.Map ) )
{
item.MoveToWorld( location, this.Map );
continue;
}
}
else
{
int height;
bool requireSurface;
if ( item is VendorRentalContract )
{
height = 16;
requireSurface = true;
}
else
{
height = item.ItemData.Height;
requireSurface = false;
}
if ( this.Map.CanFit( location.X, location.Y, location.Z, height, false, false, requireSurface ) )
{
item.MoveToWorld( location, this.Map );
continue;
}
}
// The item can't fit
if ( item is TrashBarrel )
{
item.Delete(); // Trash barrels don't go to the moving crate
}
else
{
SetLockdown( item, false );
item.IsSecure = false;
item.Movable = true;
Item relocateItem = item;
if ( item is StrongBox )
relocateItem = ((StrongBox)item).ConvertToStandardContainer();
if( item is IAddon )
{
Item deed = ((IAddon)item).Deed;
bool retainDeedHue = false; //if the items aren't hued but the deed itself is
int hue = 0;
if( item is BaseAddon && ((BaseAddon)item).RetainDeedHue ) //There are things that are IAddon which aren't BaseAddon
{
BaseAddon ba = (BaseAddon)item;
retainDeedHue = true;
for( int i = 0; hue == 0 && i < ba.Components.Count; ++i )
{
AddonComponent c = ba.Components[i];
if( c.Hue != 0 )
hue = c.Hue;
}
}
#region Mondain's Legacy
if ( deed != null )
{
if ( deed is BaseAddonContainerDeed && item is BaseAddonContainer )
{
BaseAddonContainer c = (BaseAddonContainer) item;
c.DropItemsToGround();
((BaseAddonContainerDeed) deed).Resource = c.Resource;
}
else if ( deed is BaseAddonDeed && item is BaseAddon )
((BaseAddonDeed) deed).Resource = ((BaseAddon) item).Resource;
if ( retainDeedHue )
deed.Hue = hue;
}
#endregion
relocateItem = deed;
//.........这里部分代码省略.........
示例2: AddTrashBarrel
public void AddTrashBarrel( Mobile from )
{
if ( !IsActive )
return;
for ( int i = 0; m_Doors != null && i < m_Doors.Count; ++i )
{
BaseDoor door = m_Doors[i] as BaseDoor;
Point3D p = door.Location;
if ( door.Open )
p = new Point3D( p.X - door.Offset.X, p.Y - door.Offset.Y, p.Z - door.Offset.Z );
if ( (from.Z + 16) >= p.Z && (p.Z + 16) >= from.Z )
{
if ( from.InRange( p, 1 ) )
{
from.SendLocalizedMessage( 502120 ); // You cannot place a trash barrel near a door or near steps.
return;
}
}
}
if ( m_Trash == null || m_Trash.Deleted )
{
m_Trash = new TrashBarrel();
m_Trash.Movable = false;
m_Trash.MoveToWorld( from.Location, from.Map );
from.SendLocalizedMessage( 502121 ); /* You have a new trash barrel.
* Three minutes after you put something in the barrel, the trash will be emptied.
* Be forewarned, this is permanent! */
}
else
{
m_Trash.MoveToWorld( from.Location, from.Map );
}
}
示例3: Deserialize
//.........这里部分代码省略.........
if ( version < 12 )
{
m_VendorRentalContracts = new ArrayList();
m_InternalizedVendors = new ArrayList();
}
if ( version < 4 )
m_Addons = new ArrayList();
if ( version < 7 )
m_Access = new ArrayList();
if ( version < 8 )
m_Price = DefaultPrice;
m_Owner = reader.ReadMobile();
if ( version < 5 )
{
count = reader.ReadInt();
for(int i=0;i<count;i++)
reader.ReadRect2D();
}
UpdateRegion();
m_CoOwners = reader.ReadMobileList();
m_Friends = reader.ReadMobileList();
m_Bans = reader.ReadMobileList();
m_Sign = reader.ReadItem() as HouseSign;
m_Trash = reader.ReadItem() as TrashBarrel;
m_Doors = reader.ReadItemList();
m_LockDowns = reader.ReadItemList();
for ( int i = 0; i < m_LockDowns.Count; ++i )
((Item)m_LockDowns[i]).IsLockedDown = true;
for ( int i = 0; i < m_VendorRentalContracts.Count; ++i )
((Item)m_VendorRentalContracts[i]).IsLockedDown = true;
if ( version < 3 )
{
ArrayList items = reader.ReadItemList();
m_Secures = new ArrayList( items.Count );
for ( int i = 0; i < items.Count; ++i )
{
Container c = items[i] as Container;
if ( c != null )
{
c.IsSecure = true;
m_Secures.Add( new SecureInfo( c, SecureLevel.CoOwners ) );
}
}
}
m_MaxLockDowns = reader.ReadInt();
m_MaxSecures = reader.ReadInt();
if ( (Map == null || Map == Map.Internal) && Location == Point3D.Zero )
Delete();
示例4: Deserialize
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_Region = new HouseRegion( this );
switch ( version )
{
case 0:
{
m_KeyValue = reader.ReadUInt();
m_Visits = reader.ReadInt();
m_Price = reader.ReadInt();
m_BuiltOn = reader.ReadDateTime();
m_LastTraded = reader.ReadDateTime();
m_Public = reader.ReadBool();
m_Region.GoLocation = reader.ReadPoint3D();
if ( version < 8 )
m_Price = DefaultPrice;
m_Owner = reader.ReadMobile();
UpdateRegionArea();
Region.AddRegion( m_Region );
m_Sign = reader.ReadItem() as HouseSign;
m_Trash = reader.ReadItem() as TrashBarrel;
m_Doors = reader.ReadItemList();
m_Addons = reader.ReadItemList();
if ( (Map == null || Map == Map.Internal) && Location == Point3D.Zero )
Delete();
break;
}
}
}
示例5: EmptyTimer
public EmptyTimer( TrashBarrel barrel )
: base(TimeSpan.FromMinutes( 3.0 ))
{
m_Barrel = barrel;
Priority = TimerPriority.FiveSeconds;
}
示例6: EmptyTimer
public EmptyTimer( TrashBarrel barrel )
: base(TimeSpan.FromMinutes( 3.0 ))
{
m_Barrel = barrel;
}
示例7: Deserialize
//.........这里部分代码省略.........
{
m_Addons = new List<Item>();
}
if (version < 7)
{
m_Access = new List<Mobile>();
}
if (version < 8)
{
m_Price = DefaultPrice;
}
m_Owner = reader.ReadMobile();
if (version < 5)
{
count = reader.ReadInt();
for (int i = 0; i < count; i++)
{
reader.ReadRect2D();
}
}
UpdateRegion();
m_CoOwners = reader.ReadStrongMobileList();
m_Friends = reader.ReadStrongMobileList();
m_Bans = reader.ReadStrongMobileList();
m_Sign = reader.ReadItem() as HouseSign;
m_Trash = reader.ReadItem() as TrashBarrel;
m_Doors = reader.ReadStrongItemList<Item>();
m_LockDowns = reader.ReadStrongItemList();
for (int i = 0; i < m_LockDowns.Count; ++i)
{
m_LockDowns[i].IsLockedDown = true;
}
for (int i = 0; i < m_VendorRentalContracts.Count; ++i)
{
m_VendorRentalContracts[i].IsLockedDown = true;
}
if (version < 3)
{
List<Item> items = reader.ReadStrongItemList();
m_Secures = new List<SecureInfo>(items.Count);
for (int i = 0; i < items.Count; ++i)
{
var c = items[i] as Container;
if (c != null)
{
c.IsSecure = true;
m_Secures.Add(new SecureInfo(c, SecureLevel.CoOwners));
}
}
}
m_MaxLockDowns = reader.ReadInt();
示例8: RestoreRelocatedEntities
public void RestoreRelocatedEntities()
{
foreach ( RelocatedEntity relocEntity in RelocatedEntities )
{
Point3D relLoc = relocEntity.RelativeLocation;
Point3D location = new Point3D( relLoc.X + this.X, relLoc.Y + this.Y, relLoc.Z + this.Z );
IEntity entity = relocEntity.Entity;
if ( entity is Item )
{
Item item = (Item) entity;
if ( !item.Deleted )
{
if ( item is IAddon )
{
if ( ((IAddon)item).CouldFit( location, this.Map ) )
{
item.MoveToWorld( location, this.Map );
continue;
}
}
else
{
int height;
bool requireSurface;
if ( item is VendorRentalContract )
{
height = 16;
requireSurface = true;
}
else
{
height = item.ItemData.Height;
requireSurface = false;
}
if ( this.Map.CanFit( location.X, location.Y, location.Z, height, false, false, requireSurface ) )
{
item.MoveToWorld( location, this.Map );
continue;
}
}
// The item can't fit
if ( item is TrashBarrel )
{
item.Delete(); // Trash barrels don't go to the moving crate
}
else
{
item.IsLockedDown = false;
item.IsSecure = false;
item.Movable = true;
Item relocateItem = item;
if ( item is StrongBox )
relocateItem = ((StrongBox)item).ConvertToStandardContainer();
if ( item is IAddon )
{
relocateItem = ((IAddon)item).Deed;
item.Delete();
}
if ( relocateItem != null )
DropToMovingCrate( relocateItem );
}
}
if ( m_Trash == item )
m_Trash = null;
LockDowns.Remove( item );
VendorRentalContracts.Remove( item );
Addons.Remove( item );
for ( int i = Secures.Count - 1; i >= 0; i-- )
{
if ( ((SecureInfo)Secures[i]).Item == item )
Secures.RemoveAt( i );
}
}
else
{
Mobile mobile = (Mobile) entity;
if ( !mobile.Deleted )
{
if ( this.Map.CanFit( location, 16, false, false ) )
{
mobile.MoveToWorld( location, this.Map );
}
else
{
InternalizedVendors.Add( mobile );
}
}
}
//.........这里部分代码省略.........
示例9: Deserialize
//.........这里部分代码省略.........
{
Refresh();
m_NeverDecay = false;
}
if (version < 4)
m_Addons = new ArrayList();
if (version < 7)
m_Access = new ArrayList();
if (version < 8)
m_Price = DefaultPrice;
m_Owner = reader.ReadMobile();
if (version < 5)
{
count = reader.ReadInt();
for (int i = 0; i < count; i++)
reader.ReadRect2D();
}
UpdateRegionArea();
Region.AddRegion(m_Region);
m_CoOwners = reader.ReadMobileList();
m_Friends = reader.ReadMobileList();
m_Bans = reader.ReadMobileList();
m_Sign = reader.ReadItem() as HouseSign;
m_Trash = reader.ReadItem() as TrashBarrel;
m_Doors = reader.ReadItemList();
m_LockDowns = reader.ReadItemList();
for (int i = 0; i < m_LockDowns.Count; ++i)
{
Item item = m_LockDowns[i] as Item;
if (item != null)
{
item.IsLockedDown = true;
item.CancelFreezeTimer(); // don't initiate for Deserialize
}
}
if (version < 3)
{
ArrayList items = reader.ReadItemList();
m_Secures = new ArrayList(items.Count);
for (int i = 0; i < items.Count; ++i)
{
Container c = items[i] as Container;
if (c != null)
{
c.IsSecure = true;
m_Secures.Add(new SecureInfo(c, SecureLevel.CoOwners));
}
}
}
m_MaxLockDowns = reader.ReadInt();
示例10: Deserialize
//.........这里部分代码省略.........
{
m_VendorRentalContracts = new ArrayList();
m_InternalizedVendors = new ArrayList();
}
if ( version < 4 )
m_Addons = new ArrayList();
if ( version < 7 )
m_Access = new ArrayList();
if ( version < 8 )
m_Price = DefaultPrice;
m_Owner = reader.ReadMobile();
if ( version < 5 )
{
count = reader.ReadInt();
for(int i=0;i<count;i++)
reader.ReadRect2D();
}
UpdateRegionArea();
Region.AddRegion( m_Region );
m_CoOwners = reader.ReadMobileList();
m_Friends = reader.ReadMobileList();
m_Bans = reader.ReadMobileList();
m_Sign = reader.ReadItem() as HouseSign;
m_Trash = reader.ReadItem() as TrashBarrel;
m_Doors = reader.ReadItemList();
m_LockDowns = reader.ReadItemList();
for ( int i = 0; i < m_LockDowns.Count; ++i )
((Item)m_LockDowns[i]).IsLockedDown = true;
for ( int i = 0; i < m_VendorRentalContracts.Count; ++i )
((Item)m_VendorRentalContracts[i]).IsLockedDown = true;
if ( version < 3 )
{
ArrayList items = reader.ReadItemList();
m_Secures = new ArrayList( items.Count );
for ( int i = 0; i < items.Count; ++i )
{
Container c = items[i] as Container;
if ( c != null )
{
c.IsSecure = true;
m_Secures.Add( new SecureInfo( c, SecureLevel.CoOwners ) );
}
}
}
m_MaxLockDowns = reader.ReadInt();
m_MaxSecures = reader.ReadInt();
if ( (Map == null || Map == Map.Internal) && Location == Point3D.Zero )
Delete();
示例11: MoveAllToCrate
public void MoveAllToCrate()
{
RelocatedEntities.Clear();
if ( MovingCrate != null )
MovingCrate.Hide();
if ( m_Trash != null )
{
m_Trash.Delete();
m_Trash = null;
}
foreach ( Item item in LockDowns )
{
if ( !item.Deleted )
{
item.IsLockedDown = false;
item.IsSecure = false;
item.Movable = true;
if ( item.Parent == null )
DropToMovingCrate( item );
}
}
LockDowns.Clear();
foreach ( Item item in VendorRentalContracts )
{
if ( !item.Deleted )
{
item.IsLockedDown = false;
item.IsSecure = false;
item.Movable = true;
if ( item.Parent == null )
DropToMovingCrate( item );
}
}
VendorRentalContracts.Clear();
foreach ( SecureInfo info in Secures )
{
Item item = info.Item;
if ( !item.Deleted )
{
if ( item is StrongBox )
item = ((StrongBox)item).ConvertToStandardContainer();
item.IsLockedDown = false;
item.IsSecure = false;
item.Movable = true;
if ( item.Parent == null )
DropToMovingCrate( item );
}
}
Secures.Clear();
foreach ( Item addon in Addons )
{
if ( !addon.Deleted )
{
Item deed = null;
bool retainDeedHue = false; //if the items aren't hued but the deed itself is
int hue = 0;
if( addon is IAddon )
{
deed = ((IAddon)addon).Deed;
if( addon is BaseAddon && ((BaseAddon)addon).RetainDeedHue) //There are things that are IAddon which aren't BaseAddon
{
BaseAddon ba = (BaseAddon)addon;
retainDeedHue = true;
for( int i = 0; hue == 0 && i < ba.Components.Count; ++i )
{
AddonComponent c = ba.Components[i];
if( c.Hue != 0 )
hue = c.Hue;
}
}
}
if ( deed != null )
{
#region Mondain's Legacy
if ( deed is BaseAddonContainerDeed && addon is BaseAddonContainer )
{
BaseAddonContainer c = (BaseAddonContainer) addon;
c.DropItemsToGround();
((BaseAddonContainerDeed) deed).Resource = c.Resource;
}
//.........这里部分代码省略.........
示例12: MoveAllToCrate
public void MoveAllToCrate()
{
RelocatedEntities.Clear();
if ( MovingCrate != null )
MovingCrate.Hide();
if ( m_Trash != null )
{
m_Trash.Delete();
m_Trash = null;
}
foreach ( Item item in LockDowns )
{
if ( !item.Deleted )
{
item.IsLockedDown = false;
item.IsSecure = false;
item.Movable = true;
if ( item.Parent == null )
DropToMovingCrate( item );
}
}
LockDowns.Clear();
foreach ( Item item in VendorRentalContracts )
{
if ( !item.Deleted )
{
item.IsLockedDown = false;
item.IsSecure = false;
item.Movable = true;
if ( item.Parent == null )
DropToMovingCrate( item );
}
}
VendorRentalContracts.Clear();
foreach ( SecureInfo info in Secures )
{
Item item = info.Item;
if ( !item.Deleted )
{
if ( item is StrongBox )
item = ((StrongBox)item).ConvertToStandardContainer();
item.IsLockedDown = false;
item.IsSecure = false;
item.Movable = true;
if ( item.Parent == null )
DropToMovingCrate( item );
}
}
Secures.Clear();
foreach ( Item addon in Addons )
{
if ( !addon.Deleted )
{
Item deed = null;
if ( addon is IAddon )
deed = ((IAddon)addon).Deed;
if ( deed != null )
{
addon.Delete();
DropToMovingCrate( deed );
}
else
{
DropToMovingCrate( addon );
}
}
}
Addons.Clear();
foreach ( PlayerVendor mobile in PlayerVendors )
{
mobile.Return();
mobile.Internalize();
InternalizedVendors.Add( mobile );
}
foreach ( Mobile mobile in PlayerBarkeepers )
{
mobile.Internalize();
InternalizedVendors.Add( mobile );
}
}
示例13: MoveAllDecayingToCrate
public HouseDecayingCrate MoveAllDecayingToCrate()
{
RelocatedEntities.Clear();
if ( MovingCrate != null )
MovingCrate.Hide();
HouseDecayingCrate crate = new HouseDecayingCrate();
if ( m_Trash != null )
{
m_Trash.Delete();
m_Trash = null;
}
foreach ( Item item in LockDowns )
{
if ( !item.Deleted )
{
item.IsLockedDown = false;
item.IsSecure = false;
item.Movable = true;
if ( item.Parent == null )
crate.DropItem( item );
}
}
LockDowns.Clear();
foreach ( Item item in VendorRentalContracts )
{
if ( !item.Deleted )
{
item.IsLockedDown = false;
item.IsSecure = false;
item.Movable = true;
if ( item.Parent == null )
crate.DropItem( item );
}
}
VendorRentalContracts.Clear();
foreach ( SecureInfo info in Secures )
{
Item item = info.Item;
if ( !item.Deleted )
{
if ( item is StrongBox )
item = ((StrongBox)item).ConvertToStandardContainer();
item.IsLockedDown = false;
item.IsSecure = false;
item.Movable = true;
if ( item.Parent == null )
crate.DropItem( item );
}
}
Secures.Clear();
foreach ( Item addon in Addons )
{
if ( !addon.Deleted )
{
Item deed = null;
if (addon is IAddon)
{
deed = ((IAddon)addon).Deed;
if (addon is BaseAddon && ((BaseAddon)addon).RetainDeedHue)
{
BaseAddon baseAddon = addon as BaseAddon;
for (int i = 0; deed.Hue == 0 && i < baseAddon.Components.Count; ++i)
{
AddonComponent c = (AddonComponent)baseAddon.Components[i];
if (c.Hue != 0)
deed.Hue = c.Hue;
}
}
}
if ( deed != null )
{
addon.Delete();
crate.DropItem( deed );
}
else
crate.DropItem( addon );
}
}
Addons.Clear();
return crate;
/*
foreach ( PlayerVendor mobile in PlayerVendors )
//.........这里部分代码省略.........