#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.
This commit is contained in:
parent
b51c58f514
commit
3045c83799
3512 changed files with 627673 additions and 0 deletions
1305
Scripts/Items/Misc/Corpses/Corpse.cs
Normal file
1305
Scripts/Items/Misc/Corpses/Corpse.cs
Normal file
File diff suppressed because it is too large
Load diff
20
Scripts/Items/Misc/Corpses/CorpseNameAttribute.cs
Normal file
20
Scripts/Items/Misc/Corpses/CorpseNameAttribute.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class CorpseNameAttribute : Attribute
|
||||
{
|
||||
private string m_Name;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get{ return m_Name; }
|
||||
}
|
||||
|
||||
public CorpseNameAttribute( string name )
|
||||
{
|
||||
m_Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
115
Scripts/Items/Misc/Corpses/DecayedCorpse.cs
Normal file
115
Scripts/Items/Misc/Corpses/DecayedCorpse.cs
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class DecayedCorpse : Container
|
||||
{
|
||||
private Timer m_DecayTimer;
|
||||
private DateTime m_DecayTime;
|
||||
|
||||
private static TimeSpan m_DefaultDecayTime = TimeSpan.FromMinutes( 7.0 );
|
||||
|
||||
public DecayedCorpse( string name ) : base( Utility.Random( 0xECA, 9 ) )
|
||||
{
|
||||
Movable = false;
|
||||
Name = name;
|
||||
|
||||
BeginDecay( m_DefaultDecayTime );
|
||||
}
|
||||
|
||||
public void BeginDecay( TimeSpan delay )
|
||||
{
|
||||
if ( m_DecayTimer != null )
|
||||
m_DecayTimer.Stop();
|
||||
|
||||
m_DecayTime = DateTime.UtcNow + delay;
|
||||
|
||||
m_DecayTimer = new InternalTimer( this, delay );
|
||||
m_DecayTimer.Start();
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_DecayTimer != null )
|
||||
m_DecayTimer.Stop();
|
||||
|
||||
m_DecayTimer = null;
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private DecayedCorpse m_Corpse;
|
||||
|
||||
public InternalTimer( DecayedCorpse c, TimeSpan delay ) : base( delay )
|
||||
{
|
||||
m_Corpse = c;
|
||||
Priority = TimerPriority.FiveSeconds;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Corpse.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
// Do not display (x items, y stones)
|
||||
public override bool CheckContentDisplay( Mobile from )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do not display (x items, y stones)
|
||||
public override bool DisplaysContent{ get{ return false; } }
|
||||
|
||||
public override void AddNameProperty( ObjectPropertyList list )
|
||||
{
|
||||
list.Add( 1046414, Name ); // the remains of ~1_NAME~
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
this.LabelTo( from, 1046414, Name ); // the remains of ~1_NAME~
|
||||
}
|
||||
|
||||
public DecayedCorpse( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_DecayTimer != null );
|
||||
|
||||
if ( m_DecayTimer != null )
|
||||
writer.WriteDeltaTime( m_DecayTime );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
BeginDecay( m_DefaultDecayTime );
|
||||
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if ( reader.ReadBool() )
|
||||
BeginDecay( reader.ReadDeltaTime() - DateTime.UtcNow );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
201
Scripts/Items/Misc/Corpses/Packets.cs
Normal file
201
Scripts/Items/Misc/Corpses/Packets.cs
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Network
|
||||
{
|
||||
public sealed class CorpseEquip : Packet
|
||||
{
|
||||
public CorpseEquip( Mobile beholder, Corpse beheld ) : base( 0x89 )
|
||||
{
|
||||
List<Item> list = beheld.EquipItems;
|
||||
|
||||
int count = list.Count;
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
count++;
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
count++;
|
||||
|
||||
EnsureCapacity( 8 + (count * 5) );
|
||||
|
||||
m_Stream.Write( (int) beheld.Serial );
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
Item item = list[i];
|
||||
|
||||
if ( !item.Deleted && beholder.CanSee( item ) && item.Parent == beheld )
|
||||
{
|
||||
m_Stream.Write( (byte) (item.Layer + 1) );
|
||||
m_Stream.Write( (int) item.Serial );
|
||||
}
|
||||
}
|
||||
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (byte)(Layer.Hair + 1) );
|
||||
m_Stream.Write( (int)HairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
}
|
||||
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (byte)(Layer.FacialHair + 1) );
|
||||
m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
}
|
||||
|
||||
m_Stream.Write( (byte) Layer.Invalid );
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CorpseContent : Packet
|
||||
{
|
||||
public CorpseContent( Mobile beholder, Corpse beheld )
|
||||
: base( 0x3C )
|
||||
{
|
||||
List<Item> items = beheld.EquipItems;
|
||||
int count = items.Count;
|
||||
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
count++;
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
count++;
|
||||
|
||||
EnsureCapacity( 5 + (count * 19) );
|
||||
|
||||
long pos = m_Stream.Position;
|
||||
|
||||
int written = 0;
|
||||
|
||||
m_Stream.Write( (ushort)0 );
|
||||
|
||||
for( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
Item child = items[i];
|
||||
|
||||
if( !child.Deleted && child.Parent == beheld && beholder.CanSee( child ) )
|
||||
{
|
||||
m_Stream.Write( (int)child.Serial );
|
||||
m_Stream.Write( (ushort)child.ItemID );
|
||||
m_Stream.Write( (byte)0 ); // signed, itemID offset
|
||||
m_Stream.Write( (ushort)child.Amount );
|
||||
m_Stream.Write( (short)child.X );
|
||||
m_Stream.Write( (short)child.Y );
|
||||
m_Stream.Write( (int)beheld.Serial );
|
||||
m_Stream.Write( (ushort)child.Hue );
|
||||
|
||||
++written;
|
||||
}
|
||||
}
|
||||
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (int)HairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
m_Stream.Write( (ushort)beheld.Hair.ItemID );
|
||||
m_Stream.Write( (byte)0 ); // signed, itemID offset
|
||||
m_Stream.Write( (ushort)1 );
|
||||
m_Stream.Write( (short)0 );
|
||||
m_Stream.Write( (short)0 );
|
||||
m_Stream.Write( (int)beheld.Serial );
|
||||
m_Stream.Write( (ushort)beheld.Hair.Hue );
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
m_Stream.Write( (ushort)beheld.FacialHair.ItemID );
|
||||
m_Stream.Write( (byte)0 ); // signed, itemID offset
|
||||
m_Stream.Write( (ushort)1 );
|
||||
m_Stream.Write( (short)0 );
|
||||
m_Stream.Write( (short)0 );
|
||||
m_Stream.Write( (int)beheld.Serial );
|
||||
m_Stream.Write( (ushort)beheld.FacialHair.Hue );
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
m_Stream.Seek( pos, SeekOrigin.Begin );
|
||||
m_Stream.Write( (ushort)written );
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CorpseContent6017 : Packet
|
||||
{
|
||||
public CorpseContent6017(Mobile beholder, Corpse beheld)
|
||||
: base(0x3C)
|
||||
{
|
||||
List<Item> items = beheld.EquipItems;
|
||||
int count = items.Count;
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
count++;
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
count++;
|
||||
|
||||
EnsureCapacity(5 + (count * 20));
|
||||
|
||||
long pos = m_Stream.Position;
|
||||
|
||||
int written = 0;
|
||||
|
||||
m_Stream.Write((ushort)0);
|
||||
|
||||
for (int i = 0; i < items.Count; ++i)
|
||||
{
|
||||
Item child = items[i];
|
||||
|
||||
if (!child.Deleted && child.Parent == beheld && beholder.CanSee(child))
|
||||
{
|
||||
m_Stream.Write((int)child.Serial);
|
||||
m_Stream.Write((ushort)child.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)child.Amount);
|
||||
m_Stream.Write((short)child.X);
|
||||
m_Stream.Write((short)child.Y);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write((int)beheld.Serial);
|
||||
m_Stream.Write((ushort)child.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
}
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write((int)HairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.Hair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write((int)beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.Hair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write((int)FacialHairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write((int)beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
m_Stream.Seek(pos, SeekOrigin.Begin);
|
||||
m_Stream.Write((ushort)written);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue